Ver originalfrom datetime import date s = "20020101"year = int(s[0:4])month = int(s[4:6])day = int(s[6:])d = date(year, month, day) print d