[code.view]

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

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2010 Doug Hellmann.  All rights reserved.
     #
     """
     """
     #end_pymotw_header
     
     import argparse
     from ConfigParser import ConfigParser
     import shlex
     
     parser = argparse.ArgumentParser(description='Short sample app',
                                      fromfile_prefix_chars='@',
                                      )
     
     parser.add_argument('-a', action="store_true", default=False)
     parser.add_argument('-b', action="store", dest="b")
     parser.add_argument('-c', action="store", dest="c", type=int)
     
     print parser.parse_args(['@argparse_fromfile_prefix_chars.txt'])
     

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

contact | logmethods.com