在Python中,有没有办法使argparse子命令不区分大小写?
来自 https://docs.python.org/3/library/argparse .html#sub-commands,有没有办法使 add_parser
命令不区分大小写?
例如,我希望能够使用“read_sensor”或“READ_SENSOR”读取传感器。
我知道我们可以使用类型参数使 add_argument()
命令不区分大小写,但是 add_parser
命令没有类型参数。
From https://docs.python.org/3/library/argparse.html#sub-commands, is there a way to make the add_parser
commands case insensitive?
E.g. I want to be able to read a sensor using 'read_sensor' or 'READ_SENSOR', for example.
I know we can make add_argument()
commands case insensitive using the type parameter, but the add_parser
command does not have a type parameter..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论