gbk‘ codec can‘t decode byte 0xac in position 411: illegal multibyte sequence

An error is reported when reading txt:

gbk' codec can't decode byte 0xac in position 411: illegal multibyte sequence

Error means: Unicode decoding (Decode) has an error (Error), it is decoded by gbk encoding (the string becomes Unicode), but here through gbk, it cannot be decoded (can't decode) ). "Illegal multibyte sequence" means an illegal multibyte sequence, that is, it can't (decode).

Just add utf-8 when reading

    with open("C:/V0.0.2/res_10w.txt", "r", encoding="utf-8") as fz:
        results = fz.readlines()

Guess you like

Origin blog.csdn.net/qq_35037684/article/details/113740554