Python: UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128)

后端 未结 4 846
名媛妹妹
名媛妹妹 2021-01-07 02:27

I\'m currently have an issue with my python 3 code.

 replace_line(\'Products.txt\', line, tenminus_str)

Is the line I\'m trying to turn in

4条回答
  •  渐次进展
    2021-01-07 03:24

    Handling coding problems You can try adding the following settings to your head


    import sys
    reload(sys)
    sys.setdefaultencoding('utf-8')
    Type = sys.getfilesystemencoding()
    

提交回复
热议问题