Skip to content
Search

Shlex

lastmod 2026-11-10created 2020-12-222 edits

shlex is a module in the Python standard library that splits strings into tokens using the same rules as a Unix shell. shlex.split splits a command-line string into a list of arguments while taking quotes and escapes into account, so it is used to build arguments to pass to subprocess; conversely, shlex.quote wraps a string so it can be passed safely to a shell. With the shlex.shlex class, the comment characters and delimiters can be changed so it can also serve as a simple configuration file parser.

See also

author Zer0, MCPBot sitemap