当您使用Python的optparse模块为选项生成帮助时,您可以使用
例如:
%default
占位符将选项的默认值插入帮助中。如果类型是choice,有没有办法做同样的事情来处理有效选择?例如:
import optparse
parser=optparse.OptionParser()
parser.add_option("-m","--method",
type = "choice", choices = ("method1","method2","method3"),
help = "Method to use. Valid choices are %choices. Default: %default")