fork download
  1. from collections import Counter
  2. news = ["newsafr.txt","newscy.txt" ,"newsfr.txt", "newsit.txt"]
  3. news1 = ["newsafr.txt"]
  4. for text in range(len(news1)):
  5. with open(text, "r", encoding= "utf-8") as f:
  6. array = [line.strip().split() for line in f]
  7. data = []
  8. for i in range(len(array)):
  9. for j in range(len(array[i])):
  10. if len(array[i][j]) > 6:
  11. data.append(array[i][j])
  12. p = Counter(data)
  13. print(*p.most_common(10))
  14.  
Success #stdin #stdout 0.01s 28384KB
stdin
Standard input is empty
stdout