import re
ausgabe =[]
Datum = re.compile(r"([0-2][1-9]|[3][0|1])(\/)([0-1][0-9])(\/)([0-2][0-9]{3})") #filter
Daten =(" 31/12/2000 blub 31.02.2000 und 32/01/2099 blub 28/02/2000 29/09/2009 29/39/2009 ") #Datenstr
ausgabe =Datum.findall(Daten) #durchsuchen
month = None
day = None
year = None
for Datum in ausgabe:
allright = True
day = int(Datum[0])
month =int(Datum[2])
year = int(Datum[4])
# print(day + "/" + month + "/" + year + "\n", end="")
if month == 4 or 6 or 11: #if the month is 4, 6,11
print(month)
if day > 30: #check the days of the month
allright= False
elif month == 2:
if day > 28:
print("feb hat nur 28 tage")
allright = False
elif day > 31:
print("größer als 31")
allright = False
if allright == True:
print(str(day) + "/" + str(month) + "/" + str(year) + "\n", end="")
Problem is in the following line. The month is 12 and it jumps into the next if statement inside and checks this but also if isnt 4 6 and 11. This is out of automate the boring stuff with python.
i just started coding some weeks ago so maybee its super easy to see... i rewatched some videos and thougth about it but i dont understand this
if month == 4 or 6 or 11: #if the month is 4, 6,11
print(month)
if day > 30: #check the days of the month
allright= False