import string LETTRES = string.ascii_letters MINUSCULES = LETTRES[:26] MAJUSCULES = LETTRES[26:] t = open('3.txt','r') work = t.readlines() tab = "" y = 1 verif = 0 LETTRES = string.ascii_letters for element in work: x = 0 y = 0 verif = 0 while ( x < len(element) ): if element[x] in MINUSCULES: while ( y <= 3 ): if element[x+y] in MAJUSCULES and element[x-y] in MAJUSCULES: verif = verif + 1 if verif == 3: tab = tab + element[x] y = y + 1 x = x + 1 print tab