Tutorial
now improve the program by adding the for loop as
mentioned in the lecture
Tutorial
#!/usr/bin/python
import sys, getopt
optlist, list = getopt.getopt(sys.argv[1:], ’:vphf:’)
print "optlist =", optlist
print "list =", list
for opt in optlist:
print "opt[0] = ", opt[0], "opt[1] = ", opt[1]
if opt[0] == ’-h’:
print "usage"
if opt[0] == ’-f’:
print "file found"
if opt[0] == ’-v’:
print "verbose found"
if opt[0] == ’-p’:
print "probeonly found"
没有评论:
发表评论