So I have a file called ‘clears’ and I want to see if a line contains two different strings that are in a list and if so to print those lines I cant get it to work.
for pos in positions:
for line in open('clears'):
if pos[0] and pos[3] in line:
print line
I also tried
f
or pos in positions:
for line in open('clears'):
if pos[0] in line and pos[3] in line:
print line
Thats what I tried but I get a TypeError: 'in <string>' requires string as left operand
I can get it to print if there is only one condition but I am not sure how to do if there is two.
Thanks
I guess you mean this (EDIT, back to first version):
But also, the elements of
posmust be strings.