On this page
shlex.quote
Prev: shlex.join | Up: shlex | Next: shlex.shlex
Rel: shlex.join, shlex.shlex, shlex.split
Ref: docs.python.org — shlex.quote
Tags: #public #python3 #stdlib #shlex
Import
import shlex
from shlex import quote
Signature & Overview
shlex.quote(s)
Return a shell-escaped version of the string s.
Usage
import shlex
assert shlex.quote('hello world') == "'hello world'"
assert shlex.quote('safe_name') == 'safe_name'
Gotchas
- POSIX shell quoting only (not Windows
cmd.exequoting).
REPL Inspect
from shlex import quote
help(quote)
Linked from
Related notes
- tuts/python3/stdlib_module/shlex/join Linked here; links to this page; shared tags: #shlex, #stdlib
- tuts/python3/stdlib_module/shlex/shlex Linked here; links to this page; shared tags: #shlex, #stdlib
- tuts/python3/stdlib_module/shlex/split Linked here; links to this page; shared tags: #shlex, #stdlib
- tuts/python3/stdlib_module/shlex links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib