Created
January 14, 2018 05:58
-
-
Save ipan/ea0eb983f6b96848824ef3da511088a7 to your computer and use it in GitHub Desktop.
subprocess examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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