Your code is fundamentally wrong. I didn’t see it clearly just now
with open('password', 'r', encoding='utf-8') as f:
print(f.readlines())
print(f.readlines())
The second time is directly []
The read file pointer has moved to the end, so there is no content for the second time
with open('password', 'r', encoding='utf-8') as f:
# print(f.readlines())
# print(f.readlines())
readlines = f.readlines()
print(readlines)
for i in readlines:
if i.strip() == 'abc:cba':
break
else:
print('none')
Your code is fundamentally wrong. I didn’t see it clearly just now
The second time is directly []
The read file pointer has moved to the end, so there is no content for the second time
That’s it