Python 如何判断在2中是否指定了字符串类型的选项
我正在使用python的CENTO2库解析命令行参数:Python 如何判断在2中是否指定了字符串类型的选项,python,command-line-arguments,Python,Command Line Arguments,我正在使用python的CENTO2库解析命令行参数: app.args.add_argument('-f', '--foo', action='store', metavar='STR', help='the notorious foo option') 完整的代码示例可在此处找到: 这里,-f是一个字符串选项,我想要的是它可以区分: -未提供f -f -f“foo” 但是在这里我无法区分1和2之间的区别——捕获的值都是arg.foo==None
app.args.add_argument('-f', '--foo', action='store', metavar='STR',
help='the notorious foo option')
完整的代码示例可在此处找到:
这里,-f是一个字符串选项,我想要的是它可以区分:
arg.foo==None
你知道如何区分前两个病例吗
谢谢