I want to put the date and time into a file. Below is what I have tried.
import time
import datetime
>>> test_time = open('test.time', 'w')
>>> test_time.write('today is')
>>> test_time.close()
>>> test_time = open('test.time', 'a')
>>> today = datetime.date.today()
>>> print today
2008-03-09
>>> test_time.write(today)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: argument 1 must be string or read-only character buffer, not datetime.date
>>>
My question is :
In above case, how to put the value of datetime.date.today() into the file ?
Thank you for your help !!