Command line arguements

Gabriel Genellina gagsl-py2 at
Mon Jul 28 10:29:14 CEST 2008

En Mon, 28 Jul 2008 01:43:52 -0300, Henry Chang <goldspin at> escribió:

> try optparse  :)

(optparse might be too much for a single argument)

> On Sun, Jul 27, 2008 at 9:13 PM, aditya shukla
> <adityashukla1983 at>wrote:
>> in other words i do not want to do hard code the name of the file in my
>> code every time i need to read it.
>> I was reading about the sys module and i guess sys.argv would take the
>> input from the command line whenever i run the python script .

Exactly. Try this:

import sys
print sys.argv

with no arguments, one, and several, and see what happens.

Gabriel Genellina

More information about the Python-list mailing list