<bdo id='PrwX2'></bdo><ul id='PrwX2'></ul>
  1. <small id='PrwX2'></small><noframes id='PrwX2'>

    <tfoot id='PrwX2'></tfoot>

      <legend id='PrwX2'><style id='PrwX2'><dir id='PrwX2'><q id='PrwX2'></q></dir></style></legend>
    1. <i id='PrwX2'><tr id='PrwX2'><dt id='PrwX2'><q id='PrwX2'><span id='PrwX2'><b id='PrwX2'><form id='PrwX2'><ins id='PrwX2'></ins><ul id='PrwX2'></ul><sub id='PrwX2'></sub></form><legend id='PrwX2'></legend><bdo id='PrwX2'><pre id='PrwX2'><center id='PrwX2'></center></pre></bdo></b><th id='PrwX2'></th></span></q></dt></tr></i><div id='PrwX2'><tfoot id='PrwX2'></tfoot><dl id='PrwX2'><fieldset id='PrwX2'></fieldset></dl></div>

    2. “用于线路输入..."导致 UnicodeDecodeError: 'utf-8' codec

      时间:2024-04-21
      <tfoot id='fV0AK'></tfoot>
      <legend id='fV0AK'><style id='fV0AK'><dir id='fV0AK'><q id='fV0AK'></q></dir></style></legend>

      1. <small id='fV0AK'></small><noframes id='fV0AK'>

          <tbody id='fV0AK'></tbody>
          • <bdo id='fV0AK'></bdo><ul id='fV0AK'></ul>
              <i id='fV0AK'><tr id='fV0AK'><dt id='fV0AK'><q id='fV0AK'><span id='fV0AK'><b id='fV0AK'><form id='fV0AK'><ins id='fV0AK'></ins><ul id='fV0AK'></ul><sub id='fV0AK'></sub></form><legend id='fV0AK'></legend><bdo id='fV0AK'><pre id='fV0AK'><center id='fV0AK'></center></pre></bdo></b><th id='fV0AK'></th></span></q></dt></tr></i><div id='fV0AK'><tfoot id='fV0AK'></tfoot><dl id='fV0AK'><fieldset id='fV0AK'></fieldset></dl></div>
                本文介绍了“用于线路输入..."导致 UnicodeDecodeError: 'utf-8' codec can't decode byte的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                Here is my code,

                for line in open('u.item'):
                # Read each line
                

                Whenever I run this code it gives the following error:

                UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 2892: invalid continuation byte

                I tried to solve this and add an extra parameter in open(). The code looks like:

                for line in open('u.item', encoding='utf-8'):
                # Read each line
                

                But again it gives the same error. What should I do then?

                解决方案

                As suggested by Mark Ransom, I found the right encoding for that problem. The encoding was "ISO-8859-1", so replacing open("u.item", encoding="utf-8") with open('u.item', encoding = "ISO-8859-1") will solve the problem.

                这篇关于“用于线路输入..."导致 UnicodeDecodeError: 'utf-8' codec can't decode byte的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:在 Python 3 中从 Web 下载文件 下一篇:python字符串之前的b前缀是什么意思?

                相关文章

                  <legend id='VzoTK'><style id='VzoTK'><dir id='VzoTK'><q id='VzoTK'></q></dir></style></legend>

                1. <tfoot id='VzoTK'></tfoot>
                2. <small id='VzoTK'></small><noframes id='VzoTK'>

                  <i id='VzoTK'><tr id='VzoTK'><dt id='VzoTK'><q id='VzoTK'><span id='VzoTK'><b id='VzoTK'><form id='VzoTK'><ins id='VzoTK'></ins><ul id='VzoTK'></ul><sub id='VzoTK'></sub></form><legend id='VzoTK'></legend><bdo id='VzoTK'><pre id='VzoTK'><center id='VzoTK'></center></pre></bdo></b><th id='VzoTK'></th></span></q></dt></tr></i><div id='VzoTK'><tfoot id='VzoTK'></tfoot><dl id='VzoTK'><fieldset id='VzoTK'></fieldset></dl></div>

                  • <bdo id='VzoTK'></bdo><ul id='VzoTK'></ul>