Printing date a file
wweston at att.net
Tue Aug 24 21:34:46 CEST 2004
Kory Wheatley wrote:
> In Python how would you print the date in a file, I
> have a logging program written in python and for each
> new recorded added to the file, I would like to print
> date, something like this below:
> 08/24/2004 or 08-24-2004
> Kory Wheatley
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
Works. Maybe a better way.
>>> import datetime
>>> d = datetime.datetime(2004,1,1).today()
datetime.datetime(2004, 8, 24, 12, 29, 25, 784935)
More information about the Python-list