nonblocking read()

paul koelle paul at subsignal.org
Wed Nov 17 01:17:47 CET 2004


Peter Ammon wrote:

> Are there better approaches?  Thanks,

What is wrong with:

fp = open('foo', 'r')

while 1:
   line = fp.readline()
   if not line:
     time.sleep(0.3)
     continue
   process(line)

??
  Paul




More information about the Python-list mailing list