I want to extract all dates (in the specific date format - January 1, 2020) into the dictionary in python. My text is for example:
"Psg January 1, 2020 hsjkfsdlkfhshdfh January 2, 1908 hdhahhajshjdjoi December 31, 2019 fafsfafagherhea"
I will then extract this into:
["January 1, 2020", "January 2, 1908", "December 31, 2019"]
I found the method str.split()
. No success with this.
How can I do this?
Thank you for the help!
P.S.
Actually I want to extract that dates and then convert in the format:
"January 1, 2020" -> "1. January 2020"
and then turn it back in the text.
In the nutshell: I want to replace some format of date in text with some other format of a date.
Edit:
I have made the process. Thank you for your effort!