关于python xlrd的问题
2 个回答
8
以下是xlrd的README.html中“快速开始”部分的前六行:
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上找到。如果你是通过源代码包安装xlrd或者使用Windows安装程序安装的,那么你应该已经有这些文档了。
8
Sheet
类里面有一个叫ncols
的成员,它表示这个表格有多少列。