This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Yixing Jiang
Recipients Yixing Jiang
Date 2019-09-12.13:48:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1568296085.75.0.40792729081.issue38139@roundup.psfhosted.org>
In-reply-to
Content
datetime.datetime.strptime throws out an error for me, to reproduce, use the following block:

```
>>> import datetime
>>> import pytz
>>> d2 = datetime.datetime(2019, 9, 11, 18, 35, 17, 334000, tzinfo=pytz.timezone('CET'))
>>> d2.strftime('%Y%m%d%H%M%S%f%Z')
'20190911183517334000CET'
>>> datetime.datetime.strptime('20190911183517334000CET', '%Y%m%d%H%M%S%f%Z')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/envs/lab42/lib/python3.6/_strptime.py", line 565, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "/opt/conda/envs/lab42/lib/python3.6/_strptime.py", line 362, in _strptime
    (data_string, format))
ValueError: time data '20190911183517334000CET' does not match format '%Y%m%d%H%M%S%f%Z'
>>> datetime.datetime.strptime('20190911183517334000', '%Y%m%d%H%M%S%f')
datetime.datetime(2019, 9, 11, 18, 35, 17, 334000)
```

so strptime could only handle the format without %Z.
History
Date User Action Args
2019-09-12 13:48:05Yixing Jiangsetrecipients: + Yixing Jiang
2019-09-12 13:48:05Yixing Jiangsetmessageid: <1568296085.75.0.40792729081.issue38139@roundup.psfhosted.org>
2019-09-12 13:48:05Yixing Jianglinkissue38139 messages
2019-09-12 13:48:05Yixing Jiangcreate