strptime not strict enough

Tim Roberts timr at probo.com
Wed Dec 16 00:47:00 EST 2009


Tobias Weber <towb at gmx.net> wrote:
>
>despite the directives for leading zero stime.strptime('09121', 
>'%y%m%d') returns the first of December. Shouldn't it raise ValueError?

Python merely calls the strptime function in your C run-time library.  If
it sucks, so will time.strptime.

>Where do I get strict date parsing?

You do it yourself.  Strict date parsing is incredibly tricky.

The eGenix mx.DateTime module might be more to your liking.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list