I have the following date string: '3 févr. 2015 14:26:00 CET'
datetime.datetime.strptime('03 févr. 2015 14:26:00', '%d %b %Y %H:%M:%S')
Parsing this failed with the error:
ValueError: time data '03 fxc3xa9vr. 2015 14:26:00' does not match format '%d %b %Y %H:%M:%S'
I tried to loop over all locales with locale.locale_alias
:
for l in locale.locale_alias:
try:
locale.setlocale(locale.LC_TIME, l)
print l,datetime.datetime.strptime('03 févr. 2015 14:26:00', '%d %b %Y %H:%M:%S')
break
except Exception as e:
print e
but I was not able to find the correct one.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…