[code.view]

[top] / python / PyMOTW / argparse / argparse_arguments.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2010 Doug Hellmann.  All rights reserved.
     #
     """Long option name example.
     """
     #end_pymotw_header
     
     import argparse
     
     parser = argparse.ArgumentParser(description='Example with non-optional arguments')
     
     parser.add_argument('count', action="store", type=int)
     parser.add_argument('units', action="store")
     
     print parser.parse_args()
     

[top] / python / PyMOTW / argparse / argparse_arguments.py

contact | logmethods.com