Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. from collections import Counter
  2. from pprint import pprint
  3.  
  4. files_list = ["1.txt", "2.txt"]
  5.  
  6. for file_name in files_list:
  7.     current_file = open(file_name, "r")
  8.     word_list = Counter()
  9.     for line in current_file:
  10.         word_list.update([i.strip() for i in line.split() if len(i.strip()) > 6])
  11.     print(file_name)
  12.     pprint(word_list.most_common(10))
  13.     print("\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement