how to bail if stdin is empty

Jon Schull schull at digitalgoods.com
Mon May 31 09:35:34 EDT 2004


I want to write a filter that will take input from files on the
command line and/or from stdin.

But if nothing has been piped to stdin, I don't want my program to
hang--I want it to do something else.

This is standard behavior for pipeable-programs I believe, but I can't
figure out how to do it...neither by reading from stdin nor by using
the fileinput module.

Thanks in advance!



More information about the Python-list mailing list