mardi 8 juin 2021

if statement dont work, cant compare var with text [closed]

Why is this not working? when i print (line) after the for it works but then the if´s dont work, i put the print("00000000000000000000000000000000000000000000000") in there to se if it would enter the if statement but it doesnt, also the names are correct.

global varLnkOrder                                                                  
varLnkOrder=""                                                                      
varLbook = open("Confs/bookmarks.txt", "r").readlines()                             
                                                                                    
for line in varLbook:                                                               
    print(line) #<-- returns the correct value                                                                    
    if line == "stathomeboo":                                                       
        print("00000000000000000000000000000000000000000000000") #<- dont show, even when the var line is stathomeboo                 
        varLnkOrder="stathomeboo"                                                   
        i = 0                                                                       
    elif ((line) == "stathomelib"):                                                 
        varLnkOrder="stathomelib"                                                   
        i=0                                                                         
    elif ((line) == "stathomedoc"):                                                 
        varLnkOrder = "stathomedoc"                                                 
        i = 0  

                                                                 

Aucun commentaire:

Enregistrer un commentaire