Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- pliki_w_folderze = os.listdir()
- for plik in pliki_w_folderze:
- if(plik.endswith("PL.txt")):
- print(plik)
- def parametryzacja_tekstu(nazwa_pliku):
- f = open(nazwa_pliku,"r")
- plik = f.read().lower()
- f.close()
- d = {}
- dlugosc_tekstu = len(plik)
- for i in range(ord('a'),ord('z')+1):
- d[chr(i)]=plik.strip().count(chr(i))/dlugosc_tekstu
- return(d)
- print(parametryzacja_tekstu("test.txt"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement