Apr-10-2021, 08:31 PM
Greetings!
I'm confused about how to use 'flag', I read I can use it instead of 'ELSE'.
I'm playing with the code below to see how I can use "flags" but it does not work.
I'm confused about how to use 'flag', I read I can use it instead of 'ELSE'.
I'm playing with the code below to see how I can use "flags" but it does not work.
with open ('C:/02/somefile.txt','r') as f :
flg = False
for l in f :
if '123' in l :
print (l)
flg = True
if flg == False :
print (" 'ELSE' -->> "+l)Thank you.
