Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-*- coding: utf-8 -*-
- from string import ascii_lowercase
- from collections import Counter
- import string
- chars = []
- allowed = string.ascii_letters +"æ" "ø" "å"
- with open('/Users/Thomas/Dropbox/Boag-3R.R/SRP/tællemaskine/tekst.txt') as f:
- letters = Counter(letter for line in f
- for letter in line.lower()
- if letter in allowed)
- with open('/Users/Thomas/Dropbox/Boag-3R.R/SRP/tællemaskine/tekst.txt') as f:
- for c in f.read():
- chars.append(c)
- num_letters = 0
- for c in chars:
- if c in allowed:
- num_letters += 1
- print ""
- print letters
- print ""
- print "Letter count: %d " %(num_letters)
- print "Remember to subtract the letter count with xc3"
- print ""
- print "xa5 = å"
- print "xa6 = æ"
- print "xa8 = ø"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement