Nov-17-2020, 08:53 PM
Hi, I'm getting an error:
'bool' object is not iterabler" when running this snippet and I do not understand why.
.
Could anyone elaborate?
Thank you!
'bool' object is not iterabler" when running this snippet and I do not understand why.
import os tof = ['try','two'] with open('C:/02/file1.txt', 'r') as th_th : for x in tof : for ln in th_th : if any(x in ln) : print (ln)And no errors when running this one (see below):
import os tof = ['try','two'] with open('C:/02/file1.txt', 'r') as th_th : for ln in th_th : if any(x in ln for x in tof): print (ln)They look the same to me but apparently, they are not

Could anyone elaborate?
Thank you!