Skip to content

Instantly share code, notes, and snippets.

@iamaziz
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamaziz/364b27f0ee65c7389cbc to your computer and use it in GitHub Desktop.
Save iamaziz/364b27f0ee65c7389cbc to your computer and use it in GitHub Desktop.
execute a terminal command in python with passing arguments
# execute a terminal command in python with passing arguments
# python command-line arguments
import os
arg1 = "first_argument"
arg2 = "second_argument"
terminal_command = "python test.py {0} {1}".format(arg1, arg2)
os.system(terminal_command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment