Teresa Stanton wrote: > 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] Try: filename=sys.arg[1] except exception, E: filename='FooBar'
> data = open(filename).read() > > But, if none are provided, input should come from standard input. How > do I write that code? > > TY > > > ------------------------------------------------------------------------ > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > > ------------------------------------------------------------------------ > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.446 / Virus Database: 269.0.0/750 - Release Date: 4/6/2007 9:30 > PM -- Salute! -Kirk Bailey Think +-----+ | BOX | +-----+ knihT Fnord. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor