with open(r'E:\000_auto_test\logs\103251.log') as file:
lines = file.readlines()
for line in lines:
if 'send TIM-U' in line:
print(line, end='')
解决办法:打开文件时加上encoding='utf-8'
with open(r'E:\000_auto_test\logs\103251.log', encoding='utf-8') as file:
lines = file.readlines()
for line in lines:
if 'send TIM-U' in line:
print(line, end='')
运行结果如下:问题成功解决