def date(date):
DD, MM, YYYY=date.split(' ')
return datetime.date(int(YYYY),int(MM),int(DD))
while True:
end=input('End Date (DD MM YYYY): ')
end=date(end)
if end[0:1].isdigit() and end[3:4].isdigit() and end[6:9].isdigit() and datetime.datetime.strptime(end, '%d/%m/%Y'):
break
else:
print("Invalid")
Error: Traceback (most recent call last): File "C:\Users\NPStudent\Downloads\main.py", line 311, in if start[0:1].isdigit() and start[3:4].isdigit() and start[6:9].isdigit() and datetime.datetime.strptime(start, '%d/%m/%Y'): TypeError: 'datetime.date' object is not subscriptable