Thursday, November 21, 2013

[Python2] Everything you want to know about argparse standard lib

To see all kwargs that you can pass to ArgumentParser.add_argument(), run python/ipython and type:

>>> import argparse
>>> help(argparse.Action)

Regarding to action kwarg, below is all action that you can pass:
        # register actions
        self.register('action', None, _StoreAction)
        self.register('action', 'store', _StoreAction)
        self.register('action', 'store_const', _StoreConstAction)
        self.register('action', 'store_true', _StoreTrueAction)
        self.register('action', 'store_false', _StoreFalseAction)
        self.register('action', 'append', _AppendAction)
        self.register('action', 'append_const', _AppendConstAction)
        self.register('action', 'count', _CountAction)
        self.register('action', 'help', _HelpAction)
        self.register('action', 'version', _VersionAction)
        self.register('action', 'parsers', _SubParsersAction)
Example:
parser.add_argument("-v", "--verbose", action="store_true",
                    help="increase output verbosity")
 
More example 
http://docs.python.org/2.7/howto/argparse.html 

3 comments:

7kai said...

http://stackoverflow.com/questions/810409/haskell-or-standard-ml-for-beginners

7kai said...

http://stackoverflow.com/questions/810409/haskell-or-standard-ml-for-beginners

nmxmz4i8a9 said...

In 1994, Microgaming, properly known|a extensively known} software program writer, was the first to develop on-line video poker video games. The game’s on-line versions garnered an immense liking from the recent wave of Internet savvy 카지노 사이트 players. Video poker considered one of the|is among the|is doubtless one of the} few casino video games that carry respectable odds and are value half in} for a couple of of} quick bucks. Unlike slots the place solely the casino and the developer know your odds of profitable, video poker has the transparency that you simply can} calculate your likelihood to beat the home. You may even devise a technique based on the sport that you play, and have full control over your winnings.