[Tutor] Command line args

Teresa Stanton tms43 at clearwire.net
Sat Apr 7 18:07:33 CEST 2007


If one argument to a script is provided I am to take the input from it.  I
figure that is presented like this:

filename = sys.argv[1]
data = open(filename).read()

But, if none are provided, input should come from standard input.  How do I
write that code?

TY
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070407/06412991/attachment.htm 


More information about the Tutor mailing list