Skip to content

Instantly share code, notes, and snippets.

@bl4ck5un
Created October 7, 2015 19:51
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 bl4ck5un/584c8faff5c9bb882b04 to your computer and use it in GitHub Desktop.
Save bl4ck5un/584c8faff5c9bb882b04 to your computer and use it in GitHub Desktop.
Dead simple argparse example
# from http://stackoverflow.com/a/7427376/1616210
parser = argparse.ArgumentParser(description='Description of your program')
parser.add_argument('-f','--foo', help='Description for foo argument', required=True)
parser.add_argument('-b','--bar', help='Description for bar argument', required=True)
args = vars(parser.parse_args())
if args['foo'] == 'Hello':
# code here
if args['bar'] == 'World':
# code here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment