Last active
November 23, 2015 07:08
-
-
Save nnarain/feee3bb506828a3cb8be to your computer and use it in GitHub Desktop.
This file contains 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
from argparse import ArgumentParser | |
parser = ArgumentParser() | |
parser.add_argument('-S', '--mystring', help='a string') | |
parser.add_argument('-I', '--myint', type=int, help='an integer') | |
parser.add_argument('-R', '--recursive', action='store_true', help='set recursive mode') | |
parser.add_argument('-T', '--something-else', required=True, help='some other switch') | |
args = vars(parser.parse_args()) | |
print args['mystring'] | |
print args['myint'] | |
print args['recursive'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
python argparse example