Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # -*- coding: iso-8859-15 -*-
- import re
- import os, sys
- file=open("/home/r4yan2/Downloads/divina_commedia.txt","r+")
- wordcount={}
- for word in file.read().split(s):
- word=re.sub('[^A-Za-z0-9\']+', '', word.lower())
- if word not in wordcount:
- wordcount[word] = 1
- else:
- wordcount[word] += 1
- for k,v in wordcount.items():
- print k, v
- ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement