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

shlex.join

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


Import

import shlex
from shlex import join

Signature & Overview

shlex.join(split_command)

Return a shell-escaped string from split_command.

Usage

import shlex

cmd = shlex.join(['grep', '-n', 'hello world', 'notes.txt'])
assert cmd == "grep -n 'hello world' notes.txt"

Gotchas

REPL Inspect

from shlex import join
help(join)

Linked from

Related notes