Writing an integer to a file?!?

Gabriel Ambuehl gabriel_ambuehl-py at buz.ch
Tue Nov 7 12:55:33 EST 2000


Hello python-list,
this little problem is driving me nuts:
I need to write a timestamp to a file but not as FP as Python would
supply it but as integer. Now I can convert do print int(time.time())
without any problems but as soon as I try to do f.write(int(time.time())
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

Anyone a neat solution for this problem (well, os.system('perl -e
"print time" > file') would do it, but I don't think this is
"print time" appropriate here *g*)?
  


Best regards,
 Gabriel






More information about the Python-list mailing list