Advertisement
Guest User

Untitled

a guest
May 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. #! /usr/bin/python
  2.  
  3. intrare = open('cur','r')
  4.  
  5. iesire = open ('altcur','w')
  6.  
  7. wordcount = {}
  8.  
  9. for word in intrare.read().split():
  10. if word not in wordcount:
  11. wordcount[word] = 1
  12. else:
  13. wordcount[word] += 1
  14.  
  15. iesire.write(str(wordcount))
  16.  
  17. intrare.close()
  18. iesire.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement