【发布时间】:2018-10-05 20:55:46
【问题描述】:
我正在使用 python 的 argparse 来处理参数解析。 我收到一条结构如下的默认帮助消息:
usage: ProgramName [-h] ...
Description
positional arguments:
...
optional arguments:
-h, --help show this help message and exit
...
我想要在此消息中添加一个全新的部分,例如:
usage: ProgramName [-h] ...
Description
positional arguments:
...
optional arguments:
-h, --help show this help message and exit
...
additional information:
This will show additional information relevant to the user.
....
有没有办法实现这种行为? 首选 python 2.7 和 3.x 都支持的解决方案。
编辑: 我还希望有一个解决方案,将在帮助消息底部添加新的部分/部分。
【问题讨论】: