June 2000
Intermediate to advanced
556 pages
8h 45m
English
Python's getopt library supports the use of multicharacter option names. On a command line, these are preceded by two hyphens. You tell getopt what multiline options to look for by passing in a third parameter to the getopt call. The third parameter is an array of strings as can be seen here:
CD-ROM reference=8008.txt
(options,remainder) = getopt.getopt (
sys.argv[1:],"p:mev",["AN","AV","PI",
"ETN"])
This code instructs getopt to watch for --AN, --AV, --PI and --ETN. These can be freely mixed with the single-character options -p, -m, -e and -v.
Read now
Unlock full access