python 解析参数的方法

#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()

你可能感兴趣的:(thread,python,F#)