[Python-Dev] iso8601 parsing

Paul G paul at ganssle.io
Tue Nov 28 15:07:45 EST 2017


I think the latest version can now strptime offsets of the form ±HH:MM with %z, so there's no longer anything blocking you from parsing from all isoformat() outputs with strptime, provided you know which one you need.

I think a from_isoformat() like method that *only* supports isoformat outputs is a fine idea, though, with a fairly obvious interface. I'd be happy to take a crack at it (I've been working on the somewhat harder problem of an iso8601 compliant parser for dateutil, so this is fresh in my mind).

On November 28, 2017 2:51:14 PM EST, Mike Miller <python-dev at mgmiller.net> wrote:
>This may have gotten bogged down again.  Could we get the output of 
>datetime.isoformat() parsed at a minimum?  Perfection is not required.
>
>Looks like there is a patch or two and test cases on the bug.
>
>-Mike
>
>
>> Could anyone put this five year-old bug about parsing iso8601 format
>date-times 
>> on the front burner?
>> 
>>      http://bugs.python.org/issue15873
>> 
>> In the comments there's a lot of hand-wringing about different
>variations that 
>> bogged it down, but right now I only need it to handle the output of 
>> datetime.isoformat():
>> 
>>      >>> dt.isoformat()
>>      '2017-10-20T08:20:08.986166+00:00'
>> 
>> Perhaps if we could get that minimum first step in, it could be
>iterated on and 
>> made more lenient in the future.
>> 
>_______________________________________________
>Python-Dev mailing list
>Python-Dev at python.org
>https://mail.python.org/mailman/listinfo/python-dev
>Unsubscribe:
>https://mail.python.org/mailman/options/python-dev/paul%40ganssle.io
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171128/49945a90/attachment.html>


More information about the Python-Dev mailing list