From abd22d45c5ffce7e5f0a556ad3efa77ea5139b47 Mon Sep 17 00:00:00 2001 From: Dimitri Merejkowsky Date: Sat, 19 Jan 2019 17:30:08 +0100 Subject: [PATCH] cleanup white space --- sources/06-top-words.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/sources/06-top-words.py b/sources/06-top-words.py index 199af74..8bdcc54 100644 --- a/sources/06-top-words.py +++ b/sources/06-top-words.py @@ -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) - - - -