[Tutor] A question about using stdin/out/err vs named files

2014-10-19 Thread George R Goffe
Hi,

Wow. Lots of feedback. REALLY GOOD FEEDBACK!

This was my first question to this list. Let me clarify my question.

I want to use tst.py as follows:

tst.py input-file output-file OR
cat data-file | tst.py - output-file OR
cat data-file | tst.py output-file

tst.py input-file output-file works well
tst.py - output-file works well

The question boils down to "tst.py output-file"... which is a "parsing the 
args" question which you "guys" have caused me to think more clearly about. If 
there's just 1 arg, consider it an output-file and read from stdin and write to 
output-file ONLY if output-file does not exist.

Thank you all for your very helpful and informative responses.

Regards,

George...
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] A question about using stdin/out/err vs named files

2014-10-18 Thread George R Goffe
Hi,

When you run a python program, it appears that stdin, stdout, and stderr are 
opened automatically.

I've been trying to find out how you tell if there's data in stdin (like when 
you pipe data to a python program) rather 
than in a named input file. It seems like most/all the Unix/Linux 
commands are able to figure this out. Do you know how Python programs do this 
or might do this?

MANY thanks for any/all help/hints/tips/suggestions,

George...
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor