[Tutor] time.strptime in Active State Python 2.1

Kojo Idrissa kojo@hal-pc.org
Mon, 11 Jun 2001 21:07:08 -0500


I know about the STRFTIME function, but according to Python Ess. Ref, 
there's also a STRPTIME function.  Maybe it was in 1.5.2 and it's gone in 2.1.

If that's the case, how do I go about taking a string representinig a 
certain time and turn it into a tuple  of the same form as returned by 
LOCALTIME?

Thanks,

At 02:58 AM 6/12/2001 +0100, you wrote:
> > PythonWin 2.1 (#15, Apr 23 2001, 18:00:35) [MSC 32 bit (Intel)] on win32.
> > Portions Copyright 1994-2001 Mark Hammond (MarkH@ActiveState.com) - see
> > 'Help/About PythonWin' for further copyright information.
> > <snip>
> >  >>> time.strptime('06/11/01 20:27:24',[])
> > Traceback (most recent call last):
> >    File "<interactive input>", line 1, in ?
> > AttributeError: 'time' module has no attribute 'strptime'
>
>You're trying to access the wrong function, I believe.
>
> >>> import time
> >>> dir(time)
>['__doc__', '__name__', 'accept2dyear', 'altzone', 'asctime', 'clock', 
>'ctime',
>'daylight', 'gmtime', 'localtime', 'mktime', 'sleep', 'strftime', 'time', 
>'timez
>one', 'tzname']
> >>> time.strftime
><built-in function strftime>
> >>>
>
>It's STRFTIME, if that's not clear. :)
>
>Allan.

****************************
Kojo Idrissa

kojo@hal-pc.org
http://www.hal-pc.org/~kojo/
****************************