UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 3136: illegal mult

import codecs
def read_glove_vecs(glove_file):
    with open(glove_file, 'r', encoding='utf-8') as f:   # 修改这个
        words = set()
        word_to_vec_map = {}
        
        for line in f:
            line = line.strip().split()
            curr_word = line[0]
            words.add(curr_word)
            word_to_vec_map[curr_word] = np.array(line[1:], dtype=np.float64)
            
    return words, word_to_vec_map

重启jupyter

上一篇:解决 UnicodeEncodeError: 'gbk' codec can't encode character '\u2714' in posi


下一篇:UnicodeEncodeError: 'gbk' codec can't encode character '\xa0' in position