I want to create a function or a loop with the conditional: if this string follows this format is a date, so return True, otherwise return False.
I already tried it with this code, but when I run is_date(string) it returns False, and it should return True.
string = '20090903'
def is_date(string):
    if string.format == "%YYYY%mm%dd":
        return True
    else:
        return False
is_date(string)
 
     
     
     
    
