Python 3 standard library
The Python3 Standard Library by Example
-----------------------------------------
Chapter XIV application building blocks
- ---------------------------
14.1 argparse: parsing command line options and arguments
-------------- ---------------
argparse module
Chapter XIV application building blocks
- ---------------------------
14.1 argparse: parsing command line options and arguments
-------------- ---------------
argparse module
14.1.1 the parser
14.1.2 defining parameters
argparse module
14.1.3 command line is parsed
the sys.argv [. 1:]
parse_args ()
argparse module
14.1.3 command line is parsed
the sys.argv [. 1:]
parse_args ()
14.1.4 A simple example
14.1.4.1 Parameter action
14.1.4.2 option prefix
14.1.7 Advanced parameter processing
Table flag 14-1 argparse variable parameters defined in
-------------------------------------- -------------------------------------------------- -------------------
value | meaning
---------------------------- -------------------------------------------------- -----------------------------
absolute number of parameters (eg. 3) | N
---------- -------------------------------------------------- -----------------------------------------------
|? 0 or a parameter
---------------------------------------------- -------------------------------------------------- -----------
* | 0 or all parameters
--------------------------------- -------------------------------------------------- ------------------------
+ | All (at least one) parameters
----------------------------------------- -------------------------------------------------- ----------------
-------------------------------------- -------------------------------------------------- -------------------
value | meaning
---------------------------- -------------------------------------------------- -----------------------------
absolute number of parameters (eg. 3) | N
---------- -------------------------------------------------- -----------------------------------------------
|? 0 or a parameter
---------------------------------------------- -------------------------------------------------- -----------
* | 0 or all parameters
--------------------------------- -------------------------------------------------- ------------------------
+ | All (at least one) parameters
----------------------------------------- -------------------------------------------------- ----------------
14.1.7.2 Parameter Type
14.1.7.4 custom action
14.2 getopt: command-line option parsing
------------------------------------
------------------------------------
14.2.4 A complete example
------------------------------------
------------------------------------
14.4 getpass: secure password prompt
------------------------------------
14.4.1 example
getpass () function
-------------------------------------
------------------------------------
14.4.1 example
getpass () function
-------------------------------------
14.5 cmd: line-oriented command processor
cmd module contains a public class Cmd
------------------------------------
14.5.2 command parameter
14.5 .4 automatically
------------------------------------
14.5.2 command parameter
14.5 .4 automatically