是否可以使用 Python 中的 optparse 模块制作自己的帮助消息或在帮助选项上附加自己的事件?
当然 - 只需使用 OptionParser 构造函数的参数:
import optparse
help_text = """
Hi, this is a really long help message for %prog.
It's a pretty ace thing. (C)2010 Stuff etc.
"""
parser = optparse.OptionParser(usage=help_text, version="%prog 1.0 beta")
(options, args) = parser.parse_args()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3886 次 |
| 最近记录: |