i got a list of dates, like below:
date_list = ['1. Okt 2021', '2. Okt 2021', '3. Okt 2021', '4. Okt 2021', '5. Okt 2021', '6. Okt 2021', '24. Sep 2021', '25. Sep 2021', '26. Sep 2021']
i want to transform into datetime
dates = [datetime.strptime(x,"%d %b %Y") for x in date_list]
Output is:
Traceback (most recent call last):
File "c:/Users/Benutzt/Desktop/web_scraping/main.py", line 27, in <module>
dates = [datetime.strptime(x,"%d %M %Y") for x in date_list]
File "c:/Users/Benutzt/Desktop/web_scraping/main.py", line 27, in <listcomp>
dates = [datetime.strptime(x,"%d %M %Y") for x in date_list]
File "C:\Users\Benutzt\anaconda3\lib\_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "C:\Users\Benutzt\anaconda3\lib\_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '1. Okt 2021' does not match format '%d %b %Y'