First, Introduction:
Argparse is a standard module used by Python to parse command-line arguments and options in place of obsolete optparse modules. The Argparse module is used to parse command-line arguments, such as Python parsetest.py input.txt output.txt--user=name--port=8080.
Second, the use of the steps:
1:import Argparse
2:parser = Argparse. Argumentparser ()
3:parser.add_argument ()
4:parser.parse_args ()
Explanation: Import the module first, then create a parse object, then add the command line arguments and options you want to follow to the object, each Add_argument method corresponds to a parameter or option that you want to focus on, and the last call to the Parse_args () method to parse it;
Official Document: Https://docs.python.org/2/howto/argparse.html
Official Document Translator: http://www.jianshu.com/p/a50aead61319
Python argparse module