Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import Counter
- from pprint import pprint
- files_list = ["1.txt", "2.txt"]
- for file_name in files_list:
- current_file = open(file_name, "r")
- word_list = Counter()
- for line in current_file:
- word_list.update([i.strip() for i in line.split() if len(i.strip()) > 6])
- print(file_name)
- pprint(word_list.most_common(10))
- print("\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement