On this page
  1. shlex.quote
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

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

REPL Inspect

from shlex import quote
help(quote)

Linked from

Related notes