Leading '0' error in Python in spite of its absence
Leading '0' error in Python in spite of its absence Question: from dateutil.parser import parse import re from datetime import datetime def date_fun(date): try: dt = parse(date) dt = dt.strftime(‘%d/%m/%Y’) dmy_split=re.split(‘[- / ]’, dt) # error here: if (eval(dmy_split[0])>=1 and eval(dmy_split[0])<=12 and eval(dmy_split[1])>=1 and eval(dmy_split[1])<=12 or len(dmy_split[2])==2): print("ambiguous") # Format matched else: print("True") except ValueError: …