photo
This code can't load the log.txt
file.
The file is in the temp
folder.
Why can't I load it?
This code only displays the text: Search word: ABC
.
text = input("Search word: ABC")
with open("C:\Temp\log.txt", encoding = "utf-8") as f:
cnt = 0
for line in f:
l = line.strip().split()
if (l[-1] == text):
print(line.strip())
cnt += 1
if (cnt): print(cnt, "count")
else: print(text, "No data.")