>> Apparently, use of strptime of datetime needs a workaround in Python
    >> 2.4 to work properly. The workaround is d =
    >> datetime.datetime(*(time.strptime(date_string,
    >> format)[0:5])). However, when I try to use it, or even use it the
    >> regular way, it fails with AttributeError: type object
    >> 'datetime.datetime' has no attribute 'datetime'.

Works for me:

    >>> import datetime
    >>> format = '%Y%m%d_%H%M%S'
    >>> import time
    >>> print time.strptime('20080321_113405', format)[0:5]
    (2008, 3, 21, 11, 34)
    >>> d = datetime.datetime(*time.strptime('20080321_113405', format)[0:5])
    >>> d
    datetime.datetime(2008, 3, 21, 11, 34)

Python 2.4.4, Mac OS X 10.5.4.

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

Reply via email to