Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Lib/shlex.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,18 @@ def split(s, comments=False, posix=True):


def join(split_command):
"""Return a shell-escaped string from *split_command*."""
"""Concatenate the tokens of the list *split_command* and return a string.

This is the inverse of :func:`split`: the returned value is
shell-escaped to protect against injection, so the split of the
result equals *split_command*.

>>> from shlex import split, join
>>> split('echo "hello world"')
['echo', 'hello world']
>>> join(['echo', 'hello world'])
"echo 'hello world'"
"""
return ' '.join(quote(arg) for arg in split_command)


Expand Down
Loading