如何在以下链接 http://scienceoss.com/read-excel-files-from-python/中了解 Excel 工作表中使用的总列数
谢谢..
该类Sheet
有一个ncols
成员,该成员指示列数
以下是 xlrd 的 README.html 的“快速入门”部分的前 6 行:
import xlrd
book = xlrd.open_workbook("myfile.xls")
print "The number of worksheets is", book.nsheets
print "Worksheet name(s):", book.sheet_names()
sh = book.sheet_by_index(0)
print sh.name, sh.nrows, sh.ncols
您可以通过此链接获得教程。同样,文档的最新 SVN 提交。如果您从源代码分发版或通过运行 Windows 安装程序安装 xlrd,您应该已经拥有文档。