I got txt file called RR.txt that has On and Off words so i want my program to read txt file and if there is word On in first line it will print("On")
Can someone please help me I have been trying for 1 hour and it didn't work.
with open('rr.txt', 'rt') as f:
for line in f:
if line.strip() == 'On':
alternative to the third line:
if 'On' in line.strip():
(if there's more text in the first line than just 'On')