Aug-09-2018, 12:39 PM
I've got the solution, I changed some variable to true to false and my 2 variables are now declared outside the for :
with fileinput.input(["result/"+fichier], inplace=1) as file_X : balise02R = False balise191Presente = False for line in file_X: line = line.strip('\n') if line.startswith('/02/R'): balise02R = True if line.startswith("/20/"): splitLigne20 = line.split("/") valeur20 = splitLigne20[2] if line.startswith("/66/"): splitLigne66 = line.split("/") valeur66 = splitLigne66[2] if line.startswith("/191/"): balise191Presente = True print (line.rstrip('\n')) if balise02R == True and balise191Presente == True: conditionInitial = True