Created
April 23, 2016 10:39
-
-
Save sadysnaat/831fa012248f68e6f8635c55641ad5d8 to your computer and use it in GitHub Desktop.
Use command line arguments in python script
This file contains hidden or 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 sys | |
# Read this | |
# https://docs.python.org/2/library/sys.html#sys.argv | |
# you can use | |
report = sys.argv[1] | |
# this way first argument that is passed | |
# to the script will be report location | |
# If you are further instersted you can use | |
# https://docs.python.org/dev/library/argparse.html | |
# argparse libary from python | |
# It allows you to have positional and optional arguments | |
# with ease for a gentle introduction please refer | |
# https://docs.python.org/dev/howto/argparse.html#id1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment