How to fix: “UnicodeDecodeError: 'ascii' codec can't decode byte”

前端 未结 19 1583
谎友^
谎友^ 2020-11-22 01:21
as3:~/ngokevin-site# nano content/blog/20140114_test-chinese.mkd
as3:~/ngokevin-site# wok
Traceback (most recent call last):
File \"/usr/local/bin/wok\", line 4, in
         


        
19条回答
  •  走了就别回头了
    2020-11-22 02:18

    I was searching to solve the following error message:

    unicodedecodeerror: 'ascii' codec can't decode byte 0xe2 in position 5454: ordinal not in range(128)

    I finally got it fixed by specifying 'encoding':

    f = open('../glove/glove.6B.100d.txt', encoding="utf-8")
    

    Wish it could help you too.

提交回复
热议问题