time.strptime(...) Python 1.5.2/Win32 missing ?

Fredrik Lundh fredrik at effbot.org
Wed Dec 13 15:06:37 EST 2000


Gilles Lenfant wrote:
> Where's this function???
> >>> atime = time.strptime('10:20:30', '%H:%M:%S')
> Traceback (innermost last):
>   File "<pyshell#71>", line 1, in ?
>     atime = time.strptime('10:20:30', '%H:%M:%S')
> AttributeError: strptime
>
> Seems that there's no time.strptime function! Or did I miss something ?

http://www.python.org/doc/current/lib/module-time.html

    "strptime (string[, format])
    Parse a string representing a time according to a format.

    ...

    Note: This function relies entirely on the underlying
    platform's C library for the date parsing, and some of
    these libraries are buggy. There's nothing to be done
    about this short of a new, portable implementation of
    strptime().

    Availability: Most modern Unix systems."

If you're not using a "modern Unix system", chances are that
you don't have it.

There are several pure-Python implementations of this function
(search the comp.lang.python archives if you need one).

</F>





More information about the Python-list mailing list