New submission from Yixing Jiang <johnestar....@gmail.com>:
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. ---------- components: Library (Lib) messages: 352163 nosy: Yixing Jiang priority: normal severity: normal status: open title: [BUG] datetime.strptime could not handle timezone type: crash versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38139> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com