Skip to main content

Posts

Showing posts from October, 2018

Python argparse

https://pymotw.com/3/argparse/ argparse_action.py import argparse parser = argparse . ArgumentParser () parser . add_argument ( '-s' , action = 'store' , dest = 'simple_value' , help = 'Store a simple value' ) parser . add_argument ( '-c' , action = 'store_const' , dest = 'constant_value' , const = 'value-to-store' , help = 'Store a constant value' ) parser . add_argument ( '-t' , action = 'store_true' , default = False , dest = 'boolean_t' , help = 'Set a switch to true' ) parser . add_argument ( '-f' , action = 'store_false' , default = True , dest = 'boolean_f' , help = 'Set a switch to false' )