summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorBo Bayles <bbayles@gmail.com>2019-05-29 08:06:12 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2019-05-29 08:06:11 (GMT)
commitca804955927dddb6ae5a846dbc0248a932be9a4e (patch)
treed9cb8069d21b991842d1210e1641a95ebddde912 /Doc
parentf83d1dbd3bfbde940117c85f5c70de00e47b7e6e (diff)
downloadcpython-ca804955927dddb6ae5a846dbc0248a932be9a4e.zip
cpython-ca804955927dddb6ae5a846dbc0248a932be9a4e.tar.gz
cpython-ca804955927dddb6ae5a846dbc0248a932be9a4e.tar.bz2
bpo-22454: Add shlex.join() (the opposite of shlex.split()) (GH-7605)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/shlex.rst15
-rw-r--r--Doc/whatsnew/3.8.rst5
2 files changed, 20 insertions, 0 deletions
diff --git a/Doc/library/shlex.rst b/Doc/library/shlex.rst
index fb335c6..8c5b023 100644
--- a/Doc/library/shlex.rst
+++ b/Doc/library/shlex.rst
@@ -37,6 +37,21 @@ The :mod:`shlex` module defines the following functions:
standard input.
+.. function:: join(split_command)
+
+ Concatenate the tokens of the list *split_command* and return a string.
+ This function is the inverse of :func:`split`.
+
+ >>> from shlex import join
+ >>> print(join(['echo', '-n', 'Multiple words']))
+ echo -n 'Multiple words'
+
+ The returned value is shell-escaped to protect against injection
+ vulnerabilities (see :func:`quote`).
+
+ .. versionadded:: 3.8
+
+
.. function:: quote(s)
Return a shell-escaped version of the string *s*. The returned value is a
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index d1305dc..f704b47 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -552,6 +552,11 @@ convenience functions to automate the necessary tasks usually involved when
creating a server socket, including accepting both IPv4 and IPv6 connections
on the same socket. (Contributed by Giampaolo Rodola in :issue:`17561`.)
+shlex
+----------
+
+The new :func:`shlex.join` function acts as the inverse of :func:`shlex.split`.
+(Contributed by Bo Bayles in :issue:`32102`.)
shutil
------