Browse Source

cleanup white space

master
Dimitri Merejkowsky 5 years ago
parent
commit
abd22d45c5
1 changed files with 9 additions and 13 deletions
  1. +9
    -13
      sources/06-top-words.py

+ 9
- 13
sources/06-top-words.py View File

@@ -5,25 +5,25 @@ def get_freq(nom_fich):
contenu=fich.read()
liste_frag=contenu.split() # coupe sur 'espace' et \
liste_mot=list()
for fragment in liste_frag:
for fragment in liste_frag:
fragment_min=fragment.lower()
frag_clean=clean(fragment_min)
liste_mot.append(frag_clean)
return liste_mot
def clean(fragment):
result=""
for c in fragment:
if c.isalpha():
result+=c
return result
def tri(d):
list_tuples=list()
for clé, valeur in d.items():
@@ -35,7 +35,3 @@ def tri(d):
nom_fich="ruffin.txt"
f=get_freq(nom_fich)
print(f)