【发布时间】:2014-05-24 10:57:10
【问题描述】:
我想使用 getopt 从命令行参数中获取输入,只有 long 选项
示例:./script --empid 123
options, args = getopt.getopt(sys.argv[1:],['empid='])
for opt, arg in options:
print 'opts',opt
if opt in ('--empid'):
emp_Id = arg
上面的代码出现getopt.GetoptError: option --empid not recognised 错误。可能出了什么问题?
【问题讨论】:
标签: python getopt getopt-long