Gabriel Rossetti wrote:

> I wrote a program that reads data from a file and puts it in a string,
> the problem is that it loops infinitely and that's not wanted, here is
> the code :
> 
>     d = repr(f.read(DEFAULT_BUFFER_SIZE))
>     while d != "":
>         file_str.write(d)
>         d = repr(f.read(DEFAULT_BUFFER_SIZE))
 
 
> And yes I checked, the "d" variable is en empty string at some point, so
> the looping should stop.

d may be an empty string, but repr(d) isn't:

>>> d = ""
>>> print repr(d)
''
>>> print d

Remove the two repr() calls and you should be OK.

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to