Skip to content

Commit 1d2a07f

Browse files
committed
gh-142895: Improve shlex.join documentation
1 parent 8b64dd8 commit 1d2a07f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Lib/shlex.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,14 @@ def split(s, comments=False, posix=True):
313313

314314

315315
def join(split_command):
316-
"""Return a shell-escaped string from *split_command*."""
316+
"""Return a shell-escaped string from *split_command*.
317+
318+
This function is the inverse of :func:`split`.
319+
320+
>>> import shlex
321+
>>> print(shlex.join(['echo', '-n', 'Multiple words']))
322+
echo -n 'Multiple words'
323+
"""
317324
return ' '.join(quote(arg) for arg in split_command)
318325

319326

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add examples to :func:`shlex.join` docstring.

0 commit comments

Comments
 (0)