解決 Python 中 UnicodeDecodeError: ‘cp950’ codec can’t decode
写日志记录log到txt出现cp950错误
加上
f = open("data1109.txt","r",encoding="utf-8") #注意此行
import re
f = open("data1109.txt","r",encoding="utf-8") #注意此行
line = f.read()
arr = re.findall(r"[0-9]+:[0-9]+\s", line)
print(len(arr))
https://oxygentw.net/blog/computer/python-file-utf8-encoding/