本来想写个html来玩玩,结果读取文件得时候就BUG了.... 以下代码读取html中无中文没有问题. def handle_request(client): buf = client.recv(1024) client.send(b"HTTP/1.1 200 OK\r\n\r\n") with open ('index.html','r') as f: data = f.read() data=data.encode(encoding="utf8") #print…
python3.4 UnicodeDecodeError: 'gbk' codec can't decode byte 0xff in position 实用python的时候 打开一个csv的文件出现一下错误. 然后百度了一下,找到了对应的解决方案 with open('History.csv','r',encoding='utf-8') as f: 在后面加上encoding=utf-8即可…
重现 在cmd中输入Python,运行后,出现以下错误: Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information. Failed calling…
1.报错: File "D:\Python\Python37-32\lib\site-packages\django\views\debug.py", line 332, in get_traceback_html t = DEBUG_ENGINE.from_string(fh.read()) UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 9737: illegal multibyte sequen…