#coding=utf-8
from optparse import OptionParser
if __name__ == "__main__":
usage = "usage: %prog options [target]"
parser = OptionParser(usage)
parser.add_option("-d", action="store_true", dest="Tiky", default=True, help='Hello Tiky,please')
parser.add_option("-f", action="store", dest="makefile", metavar='makefile',
help='the sln or vcproj file that this build is to use')
parser.add_option("-r", action="store_true", dest="rebuild", default=False,
help='Performs a Clean operation before build the project')
parser.add_option("-t", action="store", type="int", dest="thread", metavar='thread', default=1,
help='determine how many threads to work')
(Option, args) = parser.parse_args()
target = args[0]
print Option
print target
parser.print_help()
python 解析参数的方法
最新推荐文章于 2025-06-22 16:33:49 发布