Skip to content

Instantly share code, notes, and snippets.

@ipan
Created January 14, 2018 05:58
Show Gist options
  • Save ipan/ea0eb983f6b96848824ef3da511088a7 to your computer and use it in GitHub Desktop.
Save ipan/ea0eb983f6b96848824ef3da511088a7 to your computer and use it in GitHub Desktop.
subprocess examples
import subprocess
import shlex
cmd = 'ls -lhrt python'
subprocess.call(shlex.split(cmd))
try:
subprocess.check_output(['ls'])
except subprocess.CalledProcessError as e:
raise e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment