[Tutor] Formating from hhmms to hh:mm:ss
john at fouhy.net
Mon Sep 8 04:57:26 CEST 2008
2008/9/8 Wayne Watson <sierra_mtnview at sbcglobal.net>:
> I'm sure you have the essence below, but I'm not familiar with the In/ Out
> notation. Apparently, I need to scoop up the In lines into a file and add
> some print stmts for the In[x] d lines.
Kent uses IPython, which is an enhanced version of the standard python
shell. That's what the In and Out bits are from.
> AttributeError: type object 'datetime.datetime' has no attribute 'strptime
> This attribute problem is reminiscent of my problems. IDLE? Python 2.4.x?
Python 2.4, unfortunately. datetime.strptime only came in with Python
2.5, IIRC. The Python 2.4 version is:
d = datetime.datetime(*(time.strptime(date_string, format)[0:6]))
(i.e. that corresponds to "d = datetime.datetime.strptime(date_string, format)")
More information about the Tutor