Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我可以在python中向optparse.OptionParser添加节吗?_Python - Fatal编程技术网

我可以在python中向optparse.OptionParser添加节吗?

我可以在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

当用户在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 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