for rad in rader: if "Invalid user" in rad: # Rader som har Invalid user print (rad) # Skriv ut rader som har 'Invalid user'