"Teresa Stanton" <[EMAIL PROTECTED]> wrote

> If one argument to a script is provided I am to take the input from 
> it.

OK This sounds like a homework so I can't give you a direct
answer but only some things to consider.

> I figure that is presented like this:
>
> filename = sys.argv[1]
> data = open(filename).read()

So far so good but how will you know whether there is
anyting in sys.argv to read?

> But, if none are provided, input should come from standard input.

Standard input is where you normally get input in interactive 
programs.
How do you normally get a user to giove you information?

You'll find more about receiving input from users in the
"Talking to the User" topic of my tutorial.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


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

Reply via email to