Well I use the getopt module.

so in my foo.py it would be something like.

import getopt

try:
   opts, args = getopt.getopt(sys.argv[1:], "U:u:P:p:H:h:?",
["Username=", "username=", "Password=", "password=", "Help=","help="])
except getopt.GetoptError:
    print :nothing specila just an error"
   sys.exit(1)

for o, a in opts:
   if o in ("-U", "-u",  "--Username", "--username"): username = a
   if o in ("-P", "-p", "--Password", "--password"): password = a
   if o in ("-H", "-h","--Help", "--help","?"): print "foo help"


Hope the example helps. 

Jeff
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to