I usually do this in Perl:
whatever.pl
while(<>) { #do whatever; }
then cat foo.txt | whatever.pl
cat foo.txt | whatever.pl
Now, I
Try this:
import fileinput for line in fileinput.input(): process(line)