python 'utf-8' codec can't decode byte 0xb8 in position 0: invalid start byte

在导入csv文件中,出现如上所示的错误,经过查阅资料,解决方法如下:

方法一:

pd.read_csv(file_path, encoding=‘unicode_escape‘)

方法二:

pd.read_csc(file_path.encoding=‘gbk‘)

python 'utf-8' codec can't decode byte 0xb8 in position 0: invalid start byte

原文地址:https://www.cnblogs.com/zhichun/p/11518469.html

时间: 2024-10-09 01:08:10

python 'utf-8' codec can't decode byte 0xb8 in position 0: invalid start byte的相关文章

Running error: 'utf-8' codec can't decode byte 0xb4 in position 0: invalid start byte

Running Error: It is caused by the txt's encode format. Please do use UTF-8 to save the file (you can use Notepad++ to choose the encode format to save the file) if you would like to read in a python script. Running error: 'utf-8' codec can't decode

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

需求:python如何实现普通用户登录服务器后切换到root用户再执行命令 解决参考: 代码: def verification_ssh(host,username,password,port,root_pwd,cmd): s=paramiko.SSHClient() s.load_system_host_keys() s.set_missing_host_key_policy(paramiko.AutoAddPolicy()) s.connect(hostname = host,port=in

TensorFlow学习笔记(UTF-8 问题解决 UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte)

我使用VS2013  Python3.5  TensorFlow 1.3  的开发环境 UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte 在是使用Tensorflow读取图片文件的情况下,会出现这个报错 代码如下 # -*- coding: utf-8 -*- import tensorflow as tf import numpy as np import mat

使用Python遇到:'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte 问题

查看你的HTTP头部是否有如下头部信息:"Accept-Encoding": "gzip, deflate" 这条信息代表本地可以接收压缩格式的数据,而服务器在处理时就将大文件压缩再发回客户端,IE在接收完成后在本地对这个文件又进行了解压操作.出错的原因是因为你的程序没有解压这个文件,所以删掉这行就不会出现问题了 参考文档 http://www.cnblogs.com/xiaochun365/p/6267339.html 使用Python遇到:'utf-8' cod

Python 读取csv报错编码问题 : UnicodeDecodeError: 'utf-8' codec can't decode byte 0x87 in position 10: invalid start byte

1.报错信息 UnicodeDecodeError: 'utf-8' codec can't decode byte 0x87 in position 10: invalid start byte 2.解决方法 查找相关资料,发现一个棒棒的解决方法: 首先把csv文件以记事本的格式打开,默认保存是ANSI编码,我们应该手动修改成utf-8 ===>(如果记事本打开后是乱码,我们可以把csv数据粘贴到记事本上后保存) 3.接下来可以愉快的读文件咯 with csv23.open_csv(r'C:\

python读取mat文件:'utf-8' codec can't decode byte 0xb3 in position 38: invalid start byte

matlab保存文件格式: matlab中,“预设”,“常规”,“MAT文件”,选择第一项在保存即可. python读取mat文件:'utf-8' codec can't decode byte 0xb3 in position 38: invalid start byte 原文地址:https://www.cnblogs.com/ly123456/p/12259565.html

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

Traceback (most recent call last): File "/Users/c2apple/PycharmProjects/easyToPython/fileMethod.py", line 94, in <module> line=fp.readline() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/codecs.py", line 3

python-使用pip安装第三方库报UnicodeDecodeError: &#39;utf8&#39; codec can&#39;t decode byte 0xcb in position 7: invalid continuation byte 错误解决方案

在python 的安装目录下找到Lib\ntpath.py文件,找到def join(path, *paths):方法,添加如下两行语句: reload(sys) sys.setdefaultencoding('gbk') 出现这种错误的原因:使用pip安装文件 先将文件放在一个临时文件夹下,而此文件夹的路径存在中文无法解析 python-使用pip安装第三方库报UnicodeDecodeError: 'utf8' codec can't decode byte 0xcb in position

python3 报错:UnicodeDecodeError: &#39;utf-8&#39; codec can&#39;t decode byte 0xd6 in position 201: invalid continuation byte

代码: # -*- coding:utf-8 -*- from urllib import request resp = request.urlopen('http://www.xxx.com') print(resp.read().decode('utf-8')) 报错: Traceback (most recent call last): File "F:/workspace/python/py3/test_urllib.py", line 7, in <module>