How to detect EOF from a stream ?

Frank Buss fb at
Tue Aug 27 22:20:16 CEST 2002

spendius at (Spendius) wrote:

Try this:

from os import popen
for char in popen('date').read(): print char, ord(char)

Works on Windows XP and Linux. I'm a Python newbie, too, so I can't say, if 
this is the way you should do it in Python, but it looks really short, 
compared to the Java code :-)

Frank Buß, fb at,

More information about the Python-list mailing list