Writing an integer to a file?!?
Gabriel Ambuehl
gabriel_ambuehl-py at buz.ch
Tue Nov 7 13:44:05 EST 2000
Hello Fredrik,
Tuesday, November 07, 2000, 7:15:39 PM, you wrote:
> the error message means "expected a character buffer,
> got an integer". to put it another way, "write" needs a
> string, not an integer.
> try:
> f.write(str(int(time.time())))
> or perhaps:
> f.write("%d" % time.time())
One sole problem with this (had tested it before):
f.read() on the timestamp file will not return the last digit thus
making the whole thing pretty useless.
f.write(str(int(time.time())) + " ")
seems to solve the problem, although I need to check whether the rest
of the code will care for this...
THX anyway.
Best regards,
Gabriel
More information about the Python-list
mailing list