can't pass arguements using argparse and python 3.4.2 on Windows 7
问题 I've upgraded to Python 3.4.2 and argparse (from optparse) but neither appears to recognise command line options. As a simple test I run this; #test_argparse.py def main(): import argparse parser = argparse.ArgumentParser(description='Execute database query.') parser.add_argument("-q", "--query", dest="query", help="Name of the query file to be run") args = parser.parse_args() print(args) if __name__ == '__main__': main() From the command line, when I run test_argparse.py -q get_msre_for_book