> i did:
>
>    from time import strftime, time
>    from datetime import datetime
>
>    now = datetime.now()
>
>    self.logfile.write('%s\t'%(strftime("%Y-%m-%d",)))
>    self.logfile.write('%s\t'%(now.strftime("%H:%M:%S.%f",)))

Note that you don't need the time module here.  Datetime objects have
what you need all by themselves:

from datetime import datetime
now = datetime.now()
self.logfile.write('%s\t%s\n' % (now.strftime("%Y-%m-%d"),
                                 now.strftime("%H:%M:%S.%f")))

The time module was historically the way Python did time, but it
wasn't at all object-oriented and provided no direct support for date
arithmetic.  When Tim Peters wrote datetime, the world became a better
place.  Cozy up to the datetime documentation and put the time module
aside.

Skip

Skip
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to