strptime format string nasty default

Javier Novoa C. jstitch at invernalia.homelinux.net
Wed May 9 16:25:47 EDT 2012


On 2012-05-09, Jorgen Grahn <grahn+nntp at snipabacken.se> wrote:
>
> You'd have to read the strptime(3) manual page (it's a Unix function,
> imported straight into Python, I'm sure). Judging from a quick read
> it's not intended to support things like these. I'm surprised it
> doesn't parse your last example to (10, 52, 12) and then fail it due
> to month>12.

Well, it doesn't, at least on my Python. I'm using 2.7.3 version

>
> Can't you use a standard date format, like ISO? Apart from not being
> possible to parse with standard functions, this one looks quite odd
> and isn't very human-readable.

No, sadly the input doesn't depends on me :-(

>
> If you have to use this format, I strongly recommend parsing it
> "manually" as text first. Then you can create an ISO date and feed
> that to strptime, or perhaps use your parsed (day, month, year) tuple
> directly.

Ok, I'll do that.

>
> /Jorgen
>

Thanks!


-- 
Javier Novoa C.

--- Posted via news://freenews.netfront.net/ - Complaints to news at netfront.net ---



More information about the Python-list mailing list