官网链接:https://docs.python.org/3/library/optparse.html
https://docs.python.org/2/library/argparse.html
from optparse import OptionParser
parser = OptionParser()
parser.add_option(\"-f\", \"--file\", dest=\"filename\",
help=\"write report to FILE\", metavar=\"FILE\")
(options, args) = parser.parse_args()
print(options,type(options),args,type(args)) #print(type([])) 结果:<class \'list\'>
来源:https://www.cnblogs.com/machangwei-8/p/15171141.html
图文来源于网络,如有侵权请联系删除。