Python读取excel报Unsupported format, or corrupt file: Expected BOF record; found b'<?xml ve'问题
2017-08-02 20:10
561 查看
1、代码
2、报错信息
Unsupported format, or corrupt file: Expected BOF record; found b'<?xml ve'
3、问题原因
参阅了网上资料:https://stackoverflow.com/questions/9623029/python-xlrd-unsupported-format-or-corrupt-file
有一段这样的话:
However as the error message says, the first 8 bytes of the file are
Open it with a text editor (e.g. Notepad) that won't take any notice of the (incorrect)
and see for yourself.
[align=left]意思是说,这个文件不是个excel文件,虽然以.xls结尾,但是内部格式不对,不信你用文本编辑器打开看看,[/align]
[align=left]结果我打开是这样的:[/align]
[align=left]而正常的xls文件是这样的:[/align]
[align=left]
[/align]
[align=left][/align]
[align=left]4、结论[/align]
文中提到
Could have been saved as XML Spreadsheet (*.xml) (not supported by xlrd)
[align=left]是xlrd不支持这种方式的excel文件[/align]
[align=left][/align]
''' Created on 2017年7月7日 @author: yuanchangyou ''' # -*- coding: utf-8 -*- import xdrlib ,sys import xlrd file = 'D://yuanchangyou//yuqing.xls' try: data = xlrd.open_workbook(file,encoding_override='utf-8') return data except Exception as e: print (str(e))empty
2、报错信息
Unsupported format, or corrupt file: Expected BOF record; found b'<?xml ve'
3、问题原因
参阅了网上资料:https://stackoverflow.com/questions/9623029/python-xlrd-unsupported-format-or-corrupt-file
有一段这样的话:
However as the error message says, the first 8 bytes of the file are
'<table r'... that is definitely not Excel
.xlsformat.
Open it with a text editor (e.g. Notepad) that won't take any notice of the (incorrect)
.xlsextension
and see for yourself.
[align=left]意思是说,这个文件不是个excel文件,虽然以.xls结尾,但是内部格式不对,不信你用文本编辑器打开看看,[/align]
[align=left]结果我打开是这样的:[/align]
[align=left]而正常的xls文件是这样的:[/align]
[align=left]
[/align]
[align=left][/align]
[align=left]4、结论[/align]
文中提到
Could have been saved as XML Spreadsheet (*.xml) (not supported by xlrd)
[align=left]是xlrd不支持这种方式的excel文件[/align]
[align=left][/align]
相关文章推荐
- Unsupported format, or corrupt file: Expected BOF record; found b'\x04user '错误
- Python读取.xml文件(<?xml version="1.0" encoding="UTF-16"?>)中文乱码问题解决
- java工程内部文件路径读取问题jar:file:\No such file or directory
- Python解析大XML文件及读取XML不全的问题
- springboot打的jar包中的文件读取问题。fileNotFoundException
- #import </usr/include/objc/objc-class.h> not such file or directory问题的解决方法
- Qt4项目迁移Qt5项目一问题解决方法:#include <QtGui/QApplication> ---> No such file or directory
- python安装软件出现错误 fatal error: 'libxml/xmlversion.h' file not found
- C# XML反序列化成类时(XmlSerializer)报 System.IO.FileNotFoundException: 未能找到文件的问题
- R中读取文件,找不到路径问题 No such file or directory
- Android: Error generating final archive: Found duplicate file for APK: AndroidMainfest.xml问题
- opencv for ios 配置后#import <opencv2/opencv.hpp>报错:file not found问题(opencv3.2.0)
- R中读取文件,找不到路径问题 No such file or directory
- apktool 反编译 Input file was not found or was not readable.问题解决方案
- 关于Record not found or changed by another user的问题
- Python调用SIFT,出现“No such file or directory: '***.sift'” 问题
- <libxml/tree.h> file not found
- #import </usr/include/objc/objc-class.h> not such file or directory问题的解决方法
- Caused by: android.view.InflateException:Binary XML file line #:Error inflating class <unknown>问题
- iOS #include<Vectors/Vectors.h> file not found问题?