Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # this program and the extract of the wca export must be in the same folder
- # to run, just type "python program.py"
- # longest name without repeated letters
- import csv
- name_list = []
- size_list = []
- n = 100 # number of people to show
- flag = False
- with open('WCA_export_Persons.tsv','rb') as tsvin:
- tsvin = csv.reader(tsvin, delimiter='\t')
- for line in tsvin:
- name = line[2]
- latin = "" # latin letters only
- for x in name:
- if "a"<=x.lower()<="z":
- latin += x
- if len(latin.lower()) == len(set(latin.lower())):
- name_list += [name]
- size_list += [len(latin)]
- count = 0
- position = 1
- previous = 0
- for x, y in sorted(zip(size_list, name_list))[::-1]:
- if count >= n and x != previous:
- break
- print (str(position).zfill(3) if previous != x else "----"), x, y
- count += 1
- previous = x
- position += 1
- print "\nWCA has", len(name_list), "people with no repeated letter."
Advertisement
Add Comment
Please, Sign In to add comment