<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

      quot;for line in...quot; results in UnicodeDecodeError: #39;utf-8#39; codec can#39;t decode byte(“用于线路输入...导致 UnicodeDecodeError: utf-8 codec cant decode byte)
      <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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Split a Pandas column of lists into multiple columns(将 Pandas 的列表列拆分为多列)
                How does the @property decorator work in Python?(@property 装饰器在 Python 中是如何工作的?)
                What is the difference between old style and new style classes in Python?(Python中的旧样式类和新样式类有什么区别?)
                How to break out of multiple loops?(如何打破多个循环?)
                How to put the legend out of the plot(如何将传说从情节中剔除)
                Why is the output of my function printing out quot;Nonequot;?(为什么我的函数输出打印出“无?)

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

                  • <tfoot id='VzoTK'></tfoot>

                    <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>