Python Forum
Get True of false outside a loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get True of false outside a loop
#3
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
Reply


Messages In This Thread
Get True of false outside a loop - by morgandebray - Aug-09-2018, 10:59 AM
RE: Get True of false outside a loop - by Larz60+ - Aug-09-2018, 12:33 PM
RE: Get True of false outside a loop - by morgandebray - Aug-09-2018, 12:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  While True loop help Nickd12 2 2,002 Oct-17-2020, 08:12 AM
Last Post: Nickd12
  Is using while True loop good? escape_freedom13 5 3,558 Jul-03-2020, 08:27 PM
Last Post: escape_freedom13
  While loop = False NectDz 1 1,763 Jun-03-2020, 04:35 PM
Last Post: GOTO10
  difference between «1 in [2] == False» and «(1 in [2]) == False» fbaldit 2 2,246 Apr-20-2020, 05:39 PM
Last Post: fbaldit
  While loop doesn't end when False Kanashi 2 2,581 Nov-21-2019, 02:38 AM
Last Post: Kanashi
  Do break operators turn while loop conditions from True to False? Drone4four 5 3,002 Oct-24-2019, 07:11 PM
Last Post: newbieAuggie2019
  How to use while true/while loop on python christing 4 2,908 Oct-08-2019, 08:02 AM
Last Post: perfringo
  Returning True or False vs. True or None trevorkavanaugh 6 9,304 Apr-04-2019, 08:42 AM
Last Post: DeaD_EyE
  file.write stops while true loop from executing in python3 boonr 3 3,138 Mar-25-2019, 12:50 PM
Last Post: ichabod801
  How to make loop go back to the beginning if test evaluaes to True. FWendeburg 1 2,848 Feb-13-2019, 01:26 AM
Last Post: stullis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020