我正在使用Python的NLTK TaggedCorpusReader创建一个文本文件集。但是,其中一个文件要么不在utf-8中,要么具有不受支持的字符。有什么方法可以判断哪个文件包含问题吗?这是我的代码:corpus=nltk.corpus.TaggedCorpusReader("filepath", '.*.txt', encoding='utf-8') #Isome answer about that, but i
当并非所有文件都是utf-8编码时,poetry run pytest -v上的测试就会失败。./.pyenv/versions/3.8.2/lib/python3.8/codecs.py:322:中,在read_text中以解码方式返回f.read())= self._buffer_decode(data,self.errors,final) E UnicodeDecodeError:'utf-8‘编解码器不能<em