python - Handling options parsed from the command line -
i'm wondering how handle options have parsed command line if program rather complex , involves many options can set command line. storing them in dict , access dict when option needed, think there must better way this. don't know more efficient way.
currently getting options like:
parser = argparse.argumentparser(description='parser') parser.add_argument('--option1', type=int) args = parser.parse_args() option = {} option["option1"] = args.option1 if option["option1"]: #then use option if exists #and on
Comments
Post a Comment