手机
当前位置:查字典教程网 >脚本专栏 >python >python getopt 参数处理小示例
python getopt 参数处理小示例
摘要:opts,args=getopt.getopt(sys.argv[1:],"t:s:h",["walletype=","servicenam...

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

【python getopt 参数处理小示例】相关文章:

使用python删除nginx缓存文件示例(python文件操作)

python 参数列表中的self 显式不等于冗余

python self,cls,decorator的理解

python 获取本机ip地址的两个方法

Python的print用法示例

python thread 并发且顺序运行示例

python批量修改文件后缀示例代码分享

python函数缺省值与引用学习笔记分享

Cython 三分钟入门教程

python获取糗百图片代码实例

精品推荐
分类导航