Writing an integer to a file?!?

Fredrik Lundh fredrik at effbot.org
Tue Nov 7 19:15:39 CET 2000

Gabriel Ambuehl wrote:
> I get the following error:
> >>> f.write(int(time.time()))
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: read-only character buffer, int

the error message means "expected a character buffer,
got an integer".  to put it another way, "write" needs a
string, not an integer.



or perhaps:

    f.write("%d" % time.time())


More information about the Python-list mailing list