You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

16 lines
402 B

  1. import csv
  2. from tld import get_tld
  3. tlds = {}
  4. with open('top-1m.csv', newline='') as csvfile:
  5. lignes = csv.reader(csvfile)
  6. for ligne in lignes:
  7. tld = get_tld(ligne[1], fix_protocol=True)
  8. tlds[tld] = tlds.get(tld, 0) + 1
  9. sorted_tlds = []
  10. for w in sorted(tlds, key=tlds.get, reverse=True):
  11. if tlds[w] > 1 and "xn--" not in w:
  12. sorted_tlds.append(w)
  13. print(sorted_tlds)