ARGPARSE Newbie question

TUA kai.peters at gmail.com
Tue Apr 17 20:09:33 EDT 2018


I'd like to create a script that handles a number of verbs with mandatory and /or optional parameters like listed in the table below.

Can ARGPARSE do this and how?

Thanks for all help!





Script      Verb        Mandatory parameters                         Optional parameters 
------------------------------------------------------------------------------
myprog.py   list        ---                                          verbose 

myprog.py   add         sid(string), type (string), memory (int)     comment (string), autostart (bool, default=TRUE)

myprog.py   memory      sid (string), memory (integer)

myprog.py   comment     sid(string), comment (string)

myprog.py   restore     sid(string), srcpath (string)

myprog.py   backup      sid(string), dstpath(string) 

myprog.py   remove      sid (string)



More information about the Python-list mailing list