Created
September 18, 2019 17:01
-
-
Save xmeng1/3090ca364377d56c81f34cc3d2a2ca66 to your computer and use it in GitHub Desktop.
parser.py
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 __future__ import print_function | |
import argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--color', help='The name of the color') | |
parser.add_argument('--verbose', help='Print more data', | |
action='store_true') | |
parser.add_argument('--cuda', '-c', default=True, action='store_false') | |
args = parser.parse_args() | |
def main(): | |
global args | |
args = parser.parse_args() | |
print(args.color) | |
print(args.verbose) | |
print(args.cuda) | |
if args.cuda: | |
print("xxx") | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment