当前位置: 移动技术网 > IT编程>脚本编程>Python > python getopt 参数处理小示例

python getopt 参数处理小示例

2019年04月05日  | 移动技术网IT编程  | 我要评论

dnf前往绝密区域,沁阳市政府,天降之物12

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表示参数的全称,=表示后面需要传值

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网