import xlrd import xlwt workfile=xlrd.open_workbook("C:\Users\liuxiumin\Desktop\splitechar.xlsx") print(workfile.sheet_names()) sheettarg=workfile.sheet_by_index(0) print(sheettarg.name,sheettarg.nrows,sheettarg.ncols)
包xlrd需要下载安装,最容易的方法是安装一个Anaconda,然后在Script文件下找到pip.exe并在Script文件中打开命令行,直接输入pip install xlrd,就完成了xlrd安装。