EOF

Wojtek Walczak gminick at bzt.bzt
Fri Aug 22 21:53:58 CEST 2008


On Fri, 22 Aug 2008 22:18:37 +0530, Anjanesh Lekshminarayanan wrote:

> Im trying to download a file from a server. But how do I detect EOF ?

Whenever read() method returns empty string/list.


> while f1: # When to stop ?
     retval = f1.read()
     if not retval:
        break
     f2.write(retval)

should do the job.

-- 
Regards,
Wojtek Walczak,
http://tosh.pl/gminick/



More information about the Python-list mailing list