for rad in rader: if "Invalid user" not in rad: # INTE har söksträngen continue print (rad) # Skriv ut rader som har 'Invalid user'