The title is horrible, sorry. I´m redding form a text file that has a bunch of dates in this format:
30/5/2015
and also can appear obviously with 2 numbers in the month:
21/12/2014
this is pure text, is not formatted as a date. What i have to do is to control that the month section does not exceds the number 12. This is because sometimes the date changes it´s format and appear like :
2/15/2015--- meaning that the second place turns to days and the first one to months
This are the dates that i do not need. From the text i´m getting all this dates like this:
fechas = list(set(re.findall(r'\b(\d+/\d+/\d{4})\b', data))) --- i use set() because sometimes the dates appear more than one time
I tried something like this:
for fecha in fechas:
month = fecha[2:3]
trying to slice the string, but this wouldn´t work because of the fact that if i do this i´m getting 1 number and sometimes i need 2
Does anyone have any idea on how o do this?
Any help will be really appreciated