Emania

Vowel count

Dec 26th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. from glob import glob
  2. counts = {v : 0 for v in "aáeéěiíoóuúů"}
  3. text = "".join([open(f, "r").read() for f in glob("*.txt")])
  4. vowels = list(filter(lambda x : x in "aáeéěiíoóuúů", text))
  5. for e in vowels:
  6.     counts[e] = counts[e] + 1
  7. [print("{}: {}".format(v, c)) for v, c in counts.items() if c > 0]
Advertisement
Add Comment
Please, Sign In to add comment