Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #-*- coding: utf-8 -*-
  2. from string import ascii_lowercase
  3. from collections import Counter
  4. import string
  5. chars = []
  6. allowed = string.ascii_letters +"æ" "ø" "å"
  7.  
  8. with open('/Users/Thomas/Dropbox/Boag-3R.R/SRP/tællemaskine/tekst.txt') as f:
  9. letters = Counter(letter for line in f
  10. for letter in line.lower()
  11. if letter in allowed)
  12.  
  13.  
  14. with open('/Users/Thomas/Dropbox/Boag-3R.R/SRP/tællemaskine/tekst.txt') as f:
  15. for c in f.read():
  16. chars.append(c)
  17.  
  18. num_letters = 0
  19. for c in chars:
  20. if c in allowed:
  21. num_letters += 1
  22. print ""
  23. print letters
  24. print ""
  25. print "Letter count: %d " %(num_letters)
  26. print "Remember to subtract the letter count with xc3"
  27. print ""
  28. print "xa5 = å"
  29. print "xa6 = æ"
  30. print "xa8 = ø"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement