1 my_file = 'texte.txt' 2 file = open(my_file,'r',1) 3 line = file.readlines() 4 vocabulaire=[]; voc=[] 5 for ligne in line[:]: 6 voc = ligne.split() 7 vocabulaire += voc 8 file.close() 9 vocabulaire.sort(key=str.lower) 10 mot_precedent = '' 11 n = 0 12 for mot in vocabulaire: 13 if (mot.lower() != mot_precedent.lower()): 14 print mot.lower(), vocabulaire.count(vocabulaire[n]) 15 mot_precedent = mot 16 n += 1;