我可以在python中向optparse.OptionParser添加节吗?
当用户在python中调用我可以在python中向optparse.OptionParser添加节吗?,python,Python,当用户在python中调用prog-h时,我想在选项后面添加一个示例部分 我搜索了文件和互联网,但没有找到任何帮助 复制任务分支-h当前输出的内容: Usage ===== copy-task-branch [options] source destination Options ======= -h, --help show this help message and exit -f, --force Force rewrite of ex
prog-h
时,我想在选项后面添加一个示例部分
我搜索了文件和互联网,但没有找到任何帮助
复制任务分支-h当前输出的内容:
Usage
=====
copy-task-branch [options] source destination
Options
=======
-h, --help show this help message and exit
-f, --force Force rewrite of existing branches.
-r REVISION, --revision=REVISION
Use specific codeline revision (will not override using @ on source).
我想要的(或接近的东西):
像这样的事情是可能的吗?通过将
epilog
参数传递给OptionParser
类,可以得到这样的结果
epilog : string
paragraph of help text to print after option help
谢谢我必须从optparse.OptionParser派生一个类,并提供格式_epilog()以获得新行,但它起了作用。
epilog : string
paragraph of help text to print after option help