python getopt 参数处理小示例
更新时间:2009年06月09日 23:43:45 作者:
getopt是python中专门用来处理参数的一个模块,十分好用,下面提供一个小示例
opts, args = getopt.getopt(sys.argv[1:], "t:s:h", ["walletype=", "servicename=",'help'])
for a,o in opts:
if a in ('-t', '--walletype'):
walle_type = o
elif a in ('-s', '--servicename'):
service_name = o
elif a in ('-h', '--help'):
help = True
其中t:s:h表示参数的缩写,:表示参数后需要传值
walletype=,servicename=,help表示参数的全称,=表示后面需要传值
for a,o in opts:
if a in ('-t', '--walletype'):
walle_type = o
elif a in ('-s', '--servicename'):
service_name = o
elif a in ('-h', '--help'):
help = True
其中t:s:h表示参数的缩写,:表示参数后需要传值
walletype=,servicename=,help表示参数的全称,=表示后面需要传值
相关文章
关于PyTorch源码解读之torchvision.models
今天小编就为大家分享一篇关于PyTorch源码解读之torchvision.models,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧2019-08-08
最新评论