# python scripts are often run from the # command line. # python can retrieve and use command line # arguments with the sys module. import sys # all arguments are stored in the sys.argv list print "number of arguments passed: ", len(sys.argv) # process through the argument list for argument in sys.argv: print argument # my input/output: # python commandlinearguments.py one two three four five six seven # number of arguments passed: 8 # commandlinearguments.py # one # two # three # four # five # six # seven
A python example based blog that shows how to accomplish python goals and how to correct python errors.
Thursday, November 19, 2009
Python - processing command line arguments
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment