#!/usr/bin/python import sys import getopt def Usage (): print "usage called" sys.exit(0) try: optlist, list = getopt.getopt(sys.argv[1:], ':bvphfy:') except getopt.GetoptError: print "called exception" sys.exit(1) for opt in optlist: if opt[0] == '-h': Usage() if opt[0] == '-v': print "verbose found" if opt[0] == '-p': print "probeonly found" if opt[0] == '-f': print "file option found" if opt[0] == '-b': print "bug-me" if opt[0] == '-y': print "option y"