python xlrd读取xls文件
import xlrd
import xlwt
# 打开工作簿
book = xlrd.open_workbook("1.xls")
# 工作表行、列、单元格的读取
print("The number of worksheets is {0}".format(book.nsheets))
print("Worksheet name(s): {0}".format(book.sheet_names()))
sh = book.sheet_by_index(0)
print("{0} {1} {2}".format(sh.name, sh.nrows, sh.ncols))
print("Cell A3 is {0}".format(sh.cell_value(rowx=0, colx=2)))
for rx in range(sh.nrows):
print(sh.row(rx))

浙公网安备 33010602011771号