Home  >  Q&A  >  body text

python - github: An input and output program code. I just changed the data in the tsv file. Why can't it be output and a UnicodeDecodeError occurs?

I copied a complete input and output code program that could be run, and then I modified the data of the tsv file. The original data was as follows and I modified it to the picture below. Then it cannot run and the following error occurs
How to correct this situation? ? ?

滿天的星座滿天的星座2683 days ago849

reply all(3)I'll reply

  • 高洛峰

    高洛峰2017-06-15 09:23:21

    Reminds me of the previous post on Zhihu "What are the "black spots" in each programming language", which contains an answer about Python
    https://zhihu.com/question/53..., how can I save you? , the method is also very simple, you need to read "Why is Python coding so painful?" 》The most upvoted answer.

    reply
    0
  • 扔个三星炸死你

    扔个三星炸死你2017-06-15 09:23:21

    This is a problem with Chinese encoding. You can solve this type of problem if you understand the connection between the decode, encode, and unicode methods. This kind of problem is often encountered, so you need to learn how to fish.

    reply
    0
  • 扔个三星炸死你

    扔个三星炸死你2017-06-15 09:23:21

    Let’s try it with python3 first!

    reply
    0
  • Cancelreply