机灵路人

文章
4
资源
0
加入时间
3年1月16天

python 参数封装库 argparse 的使用

import argparseparser = argparse.ArgumentParser()parser.add_argument("square",help="display a square of a given number",choices=[1,5,10], type=int)#required只能用前面带-的可选参数:# python mypythonTest.py --help 可查看帮助:-F floatArg, --ff float