Skip to content

Instantly share code, notes, and snippets.

@sidja
Created December 22, 2016 02:51
Show Gist options
  • Save sidja/c5692a0cb236df307d5e2bb6345bbeb4 to your computer and use it in GitHub Desktop.
Save sidja/c5692a0cb236df307d5e2bb6345bbeb4 to your computer and use it in GitHub Desktop.
Run shell commands via python
import subprocess
def run(command):
my_env = os.environ.copy()
print(command)
return subprocess.check_output(command, shell=True, env=my_env)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment