Pandas和xlrd读取xls报错解决方法

xlrd错误信息:

Unsupported format, or corrupt file: Expected BOF record; found b'<html xm'

pandas错误信息:

ValueError: File is not a recognized excel file

解决方法:

文件是嵌套的html文件

import pandas as pd

df = pd.read_html(r"C:\Users\admin\Downloads\XXXX.xls")[0]

猜你喜欢

转载自blog.csdn.net/Father_of_Python/article/details/127427718