import locale locale.setlocale(locale.LC_TIME, 'esp') from datetime import datetime date_string = "**1 de agosto, 2019"** date_object = datetime.strptime(date_string, "%d %B, %Y") print("date_object: ", date_object)
What I expected to happen:
Date object: 2019-08-01 00:00:00
What actually happened:
time data ‘1 de agosto, 2019’ does not match format ‘%d %B, %Y’
Replace this line with the output/error
I am an Spanish Native speaker, so I have to work with months in that language, when I tried to work with “locale” to start working with months in spanish throws an error, but if I work in English is ok.
I looked at datetime tutorial from Dataquest but did not mentione “locale” function. What I can do?