2024-04-26 17:49:44 发布
网友
考虑以下因素:
parser.add_option("-f", "--file", "--secret", action = "append", type = "string", dest = "filename", default = [], help = "specify the files")
我想在调用帮助时对用户隐藏--secret选项。我可以用下面的方法吗?在
我这样做是否遗漏了任何隐藏的问题?如果是这样的话,有人能提出一个替代方法来实现这一点吗。在
尝试help=SUPPRESS_HELP技巧(参见docs):
help=SUPPRESS_HELP
from optparse import OptionParser, SUPPRESS_HELP parser.add_option("-f", " file", action = "append", type = "string", dest = "filename", default = [], help = "specify the files") parser.add_option(" secret", action = "append", type = "string", dest = "filename", default = [], help=SUPPRESS_HELP)
尝试
help=SUPPRESS_HELP
技巧(参见docs):相关问题 更多 >
编程相关推荐