Created
August 21, 2014 14:52
-
-
Save cngkaygusuz/5405e694afd95357a29f to your computer and use it in GitHub Desktop.
Get arguments from command line using built-in argparse library and receive them in a dictionary.
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 argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument("--argument_one", help="This argument does nothing") | |
parser.add_argument("--argument_two", help="This argument is even more useless than other one.") | |
parsed = parser.parse_args() # By default, this uses sys.argv. | |
# This means the arguments doesnt have to be coming from CLI. | |
print parsed.__dict__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment