A
Adam Funk
I'm using this sort of standard thing:
for line in fileinput.input():
do_stuff(line)
and wondering whether it reads until it hits an EOF and then passes
lines (one at a time) into the variable line. This appears to be the
behaviour when it's reading STDIN interactively (i.e. from the
keyboard).
As a test, I tried this:
for line in fileinput.input():
print '**', line
and found that it would print nothing until I hit Ctl-D, then print
all the lines, then wait for another Ctl-D, and so on (until I pressed
Ctl-D twice in succession to end the loop).
Is it possible to configure this to pass each line of input into line
as it comes?
Thanks,
Adam
for line in fileinput.input():
do_stuff(line)
and wondering whether it reads until it hits an EOF and then passes
lines (one at a time) into the variable line. This appears to be the
behaviour when it's reading STDIN interactively (i.e. from the
keyboard).
As a test, I tried this:
for line in fileinput.input():
print '**', line
and found that it would print nothing until I hit Ctl-D, then print
all the lines, then wait for another Ctl-D, and so on (until I pressed
Ctl-D twice in succession to end the loop).
Is it possible to configure this to pass each line of input into line
as it comes?
Thanks,
Adam