对于命令行参数的定义和使用,有一套完整的规则,以linux上的ls命令为例
ls --help
Usage: ls [OPTION]... [FILE]......位置参数是必须提供的,前面不需要短横杠的修饰,直接就是参数名称,ls命令的用法示意如下
ls -l dir
其中-l就是一个选项, dir则是一个位置参数, 要在python脚本中实现这样的命令行传参,...,'--threads', type = int, default = 10)
_StoreAction(option_strings=['-t', '--threads'], dest='threads...,'--threads', dest = 'cpus', type = int, default = 10)
_StoreAction(option_strings=['-t', '--threads'..._StoreAction(option_strings=['-t', '--threads'], dest='threads', nargs=None, const=None, default=10,