[New-bugs-announce] [issue29690] no %z directive for strptime in python2, doc says nothing about it

Mathieu Dupuy report at bugs.python.org
Thu Mar 2 02:31:29 EST 2017


New submission from Mathieu Dupuy:

➜  ~ cat dt.py 
from datetime import *
dt = datetime.strptime('+1720', '%z')
print(dt)
➜  ~ python2 dt.py 
Traceback (most recent call last):
  File "dt.py", line 2, in <module>
    dt = datetime.strptime('+1720', '%z')
  File "/usr/lib/python2.7/_strptime.py", line 324, in _strptime
    (bad_directive, format))
ValueError: 'z' is a bad directive in format '%z'
➜  ~ python3 dt.py
1900-01-01 00:00:00+17:20

We should either mention it in doc, either cherry-pick the code from python3

----------
components: Library (Lib)
messages: 288782
nosy: deronnax
priority: normal
severity: normal
status: open
title: no %z directive for strptime in python2, doc says nothing about it
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29690>
_______________________________________


More information about the New-bugs-announce mailing list