@TOC
Excel格式的读写
导入操作 Excel 表格模块
import xlrd
读取Excel文件
def read_excel():
workbook = xlrd.open_workbook('data.xls')
nameList = workbook.sheet_names()
print(nameList)
print('*' * 50)
tableOne = workbook.sheet_by_name(nameList[0]) # 打开第一个表
rows = tableOne.nrows# 行
cols = tableOne.ncols# 列
for i in range(0, rows):
rows_value = tableOne.row_values(i)
print(rows_value)
print('*'*50)
for i in range(0, cols):
cols_vlaue = tableOne.col_values(i)
print(cols_vlaue)
print('*' * 50)
cell_value = tableOne.cell_value(1,1)
print(cell_value)
read_excel()