Is 'encoding is an invalid keyword' error inevitable in python 2.x?

后端 未结 4 1894
清酒与你
清酒与你 2020-12-08 00:21

Ansi to UTF-8 using python causing error

I tried the answer there to convert ansi to utf-8.

import io

with io.open(file_path_ansi, encoding=\'latin-         


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 01:10

    I had the same issue when I did try to write bytes to file. So my point is, bytes are already encoded. So when you use encoding keyword this leads to an error.

提交回复
热议问题