ValueError time data 'Fri Mar 11 15:59:57 EST 2016' does not match format '%a %b %d %H:%M:%S %Z %Y'

丶灬走出姿态 提交于 2019-12-01 17:51:39
ecatmur

For the %Z specifier, strptime only recognises "UTC", "GMT" and whatever is in time.tzname (so whether it recognises "EST" will depend on the time zone of your computer). This is issue 22377.

See:

The best option for parsing timezones that include a human-readable time zone is still to use the third-party python-dateutil library:

import dateutil
date = dateutil.parse('Fri Mar 11 15:59:57 EST 2016')

If you cannot install python-dateutil, you could strip out the timezone and parse it manually e.g. using a dictionary lookup.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!