two newbie questions ... "date from string"

Duncan Booth duncan at NOSPAMrcp.co.uk
Tue May 13 09:53:11 EDT 2003


Andrew Bennetts <andrew-pythonlist at puzzling.org> wrote in
news:mailman.1052828241.31325.python-list at python.org: 

>> Unfortunately, unless you are using Python 2.3, you will find that
>> not all platforms include the time.strptime function (I think Unix
>> has it, Windows doesn't). In Python 2.3 strptime is implemented in a
>> module _strptime.py which should be useable on 2.2.1+ if you copy it.
> 
> Python 2.3's _strptime module uses the new datetime module, which is a
> C extension, so using it in 2.2 is non-trivial.

Thanks, I didn't spot that. Instead I fell for the accurate yet incomplete 
information in the docstring:

Requires Python 2.2.1 or higher (mainly because of the use of property()).
Can be used in Python 2.2 if the following line is added:
    True = 1; False = 0

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?




More information about the Python-list mailing list