Skip to content

Instantly share code, notes, and snippets.

@s-boardman
Forked from kmanalo/argparse.gist
Last active August 29, 2015 14:15
Show Gist options
  • Save s-boardman/efe57366f8bd040e3c39 to your computer and use it in GitHub Desktop.
Save s-boardman/efe57366f8bd040e3c39 to your computer and use it in GitHub Desktop.
# argparse section
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-l","--list", help="pass a list", nargs="*")
parser.add_argument("-b","--boolean", action="store_true", default=False, help="use this flag to turn on an option")
# grab the options here from the command line, console overrides email
args = parser.parse_args()
list = args.list
if args.boolean is True:
boolean = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment