裕~ 发表于 2021-10-27 19:46:02

29讲 文件报错

Traceback (most recent call last):
File "C:/Users/ALIENWARE/Desktop/python/筛选text中的语句.py", line 7, in <module>
    for sentence in f:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xbc in position 8: illegal multibyte sequence

代码运行显示这一段,是写错了吗?我查中文他好像也不是写错了的意思

suchocolate 发表于 2021-10-27 19:55:47

with open('xxx.txt', encoding='utf-8') as f:
加红色字
页: [1]
查看完整版本: 29讲 文件报错