parser = argparse.ArgumentParser(
prog='PROG',
formatter_class=argparse.MetavarTypeHelpFormatter)
parser.add_argument('--foo', type=int)
parser.add_argument('bar', type=float)
parser.print_help()
什么是metavar?你知道吗
MetavarTypeHelpFormatter做什么?你知道吗
在什么情况下我们使用metavar?你知道吗
您忘记显示的帮助:
看到
int
和float
单词了吗?它们匹配type
参数。你知道吗没有特殊格式化程序类的帮助:
FOO
和bar
。你知道吗使用显式
metavar
:相关问题 更多 >
编程相关推荐