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

shlex.split

Prev: shlex.shlex | Up: shlex
Rel: shlex.join, shlex.quote, shlex.shlex
Ref: docs.python.org — shlex.split
Tags: #public #python3 #stdlib #shlex


Import

import shlex
from shlex import split

Signature & Overview

shlex.split(s, comments=False, posix=True)

Split the string s using shell-like syntax.

Usage

import shlex

assert shlex.split('git commit -m "fix bug"') == ['git', 'commit', '-m', 'fix bug']

Gotchas

REPL Inspect

from shlex import split
help(split)

Linked from

Related notes