On this page
glob.escape
Up: glob | Next: glob.glob
Rel: glob.glob, glob.iglob, glob.translate
Ref: docs.python.org — glob.escape
Tags: #public #python3 #stdlib #glob
Import
import glob
from glob import escape
Signature & Overview
glob.escape(pathname)
Escape all special characters.
Usage
import glob
assert glob.escape("file[1].txt") == "file[[]1].txt"
Gotchas
- Escape literal directory paths containing
[,],*, or?before appending/*.py.
REPL Inspect
from glob import escape
help(escape)
Linked from
Related notes
- tuts/python3/stdlib_module/glob/glob Linked here; links to this page; shared tags: #glob, #stdlib
- tuts/python3/stdlib_module/glob/iglob Linked here; links to this page; shared tags: #glob, #stdlib
- tuts/python3/stdlib_module/glob/translate Linked here; links to this page; shared tags: #glob, #stdlib
- tuts/python3/stdlib_module/glob 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