Advertisement
Guest User

Untitled

a guest
Oct 20th, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. import re
  2. from collections import Counter
  3.  
  4. fileName = '%Имя_файла_с_сабами_идёт_здесь%'
  5. fileInput = open(fileName, 'r')
  6. allWords = []
  7.  
  8. for line in fileInput.readlines():
  9.     allWords += re.findall('\w+', re.sub('[\d+,:\->\.\n\?"]', '', line))
  10.  
  11. wordCounts = Counter(allWords)
  12.  
  13. print(wordCounts)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement