Saving variable value to a file does not work!!!!

Oleg Broytmann phd at phd.pp.ru
Sun Sep 30 12:06:10 EDT 2001


On Sun, Sep 30, 2001 at 06:04:33PM +0200, Husam wrote:
>         output.write(counter +1)            # This is the trouble making
> 
> Traceback (innermost last):
>   File "./script.py", line 23, in ?
>     output.write(counter+1)
> TypeError: read-only buffer, int

   Python files only accept string. So convert your data to a string:

      output.write(str(counter + 1))

Oleg.
---- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.




More information about the Python-list mailing list