Answer the question
In order to leave comments, you need to log in
String comparisons from array and file?
I need to output all non-matching lines from the file
, here is the code, but I don’t understand what the error is
a = ['1','2']
file = open('test.txt')
for line in file:
if line not in a:
print(line)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question