I need help in checking if the given date is present in the date format of a list. I have a list of date formats. I want to check if a given date is present in that date format. How do I do that? However, I tried doing it though getting an error.
My code:
x = "03-24-2019"
Date = ['%Y/%m/%d','%Y-%m-%d','%Y%m%d','%m/%d/%Y','%m-%d-%Y']
if x in any(Date):
print(Date)
else:
print('no')
Error message:
TypeError: argument of type 'bool' is not iterable
Execpted Output:
%m-%d-%Y
any(Date)is justTrue