Пример #1
0
#matches = []
with open(filename) as f:
    reader = csv.reader(f)
    i = 0
    for row in reader:
        i += 1
        
        # skipping the headline
        if i < 5: continue
        if len(row) == 7:
            row = row[1:]
        if len(row) != 6: break

        print("Inserting: {0!r}".format(row))
        teamA = row[0].strip()
        teamB = row[1].strip()
        field = row[2].strip()

        match_time = time.strptime(row[4].strip(), "%m/%d/%y %a")

        day = int((time.mktime(match_time) - time.mktime(start_date))/(60*60*24)) + 1

        match_time = row[5].strip()[:5]


        print("Got back: {0!r}".format(t.add_match(teamA, teamB, day, field, match_time, group)))
        
        #matches.append((teamA, teamB, field, day, match_time))