Tutorial
cut and paste the following program into a file called:
lab7.py
#!/usr/bin/python
import sys, getopt
optlist, list = getopt.getopt(sys.argv[1:], ’:vphf:’)
print "optlist =", optlist
print "list =", list
Tutorial
run the program from the command line
$ python lab7.py -v
$ python lab7.py -h
$ python lab7.py -p
$ python lab7.py -pvh
$ python lab7.py -p -vh
$ python lab7.py -p -vf foobar
ensure that you understand what the optlist values
mean and how they relate to the options on the
command line
没有评论:
发表评论