Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from datetime import date
- import csv
- limit = 100
- def get_comp_with_n_days(days):
- out = []
- c = True
- with open('WCA_export_Competitions.tsv','rb') as tsvin:
- tsvin = csv.reader(tsvin, delimiter='\t')
- name = []
- country = []
- events_number = []
- for line in tsvin:
- if c:
- c = False
- continue
- year = int(line[5])
- month = int(line[6])
- day = int(line[7])
- end_month = int(line[8])
- end_day = int(line[9])
- d0 = date(year, month, day)
- d1 = date(year, end_month, end_day)
- delta = d1 - d0
- if abs(delta.days)+1 == days:
- name.append(line[1])
- country.append(line[3])
- events_number.append(len(line[10].split()))
- count = 0
- previous = 0
- for x, y, z in sorted(zip(events_number, name, country)):
- count += 1
- if (count >= limit and x != previous) or (x>17): break
- previous = x
- print x, "-", y, "-", z
- get_comp_with_n_days(3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement