dateCreated = datetime.strptime(item['dateCreated'].replace(',',''), '%b %d %Y')
^^代码^^
Python strptime : time data 'January 03 2017' does not match format '%b %d %Y'
^^错误^^
运行Python 2.7
我知道已经问过类似的问题,但是没有一个答案符合我的情况。
仔细观察文档(重点是我的):
%b-月份为locale的缩写名称。(1月,2月,…,dec)
%b-月份为Locale的完整名称。(1月,2月,…,12月)
您想要'%B %d %Y'
,而不是'%b %d %Y'
。
%b
用于缩写的月份名称。您想要%B
。