【发布时间】:2019-09-02 12:02:41
【问题描述】:
如何解析格式为 +00 的时区偏移量? Python 3 或 Python 2
from datetime import datetime
s = '2019-04-10 21:49:41.607472+00'
# What must I replace <XX> with, to parse +00 as the timezone offset
d = datetime.strptime(s, '%Y-%m-%d %H:%M:%S.%f<XX>')
【问题讨论】: