I found a module that wrote a python script and cleaned up how to pass options. That is optparse
The usage is as follows.
#First import the module
import optparse
#Creating the main object for the parser
parser = optparse.OptionParser()
#Add settings for each option
#In this case--Get it later if you give a debug argument
#The debug property of the options object becomes True
#help is--Displayed with each option when help is given
#usage A message.
parser.add_option("--debug",
action="store_true",
dest="debug",
help="Debug option")
#options has the value of each option as an associative array.
#After that, it will be boiled or baked.
(options, args) = parser.parse_args()
It's very convenient because you don't have to worry about the order.
Recommended Posts