首页 文章

UnicodeDecodeError:'ascii' codec无法解码位置0的字节0xdb:序号不在范围内(128)

提问于
浏览
0

当我使用 pickle.load 加载文件时,我遇到了这个错误 .

with open("tfidf_vectorizer", mode='r+b') as handle:                            
    tfidf_vectorizer = pickle.load(handle)

UnicodeDecodeError:'ascii'编解码器无法解码位置0的字节0xdb:序号不在范围内(128)

1 回答

  • 1

    尝试在读取文件时设置编码 .

    Ex:

    with open("tfidf_vectorizer", mode='r+b', encoding='utf-8') as handle:                            
        tfidf_vectorizer = pickle.load(handle)
    

相关问题