I want to have some options in argparse module such as --pm-export however when I try to use it like args.pm-export I get the error that there is n
--pm-export
args.pm-export
Concise and explicit but probably not always acceptable way would be to use vars():
vars()
#!/usr/bin/env python3 import argparse parser = argparse.ArgumentParser() parser.add_argument('a-b') args = vars(parser.parse_args()) print(args['a-b'])