How to detect EOF from a stream ?

Frank Buss fb at frank-buss.de
Tue Aug 27 16:20:16 EDT 2002


spendius at muchomail.com (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 frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de



More information about the Python-list mailing list