python--读取Excel内容
import xlrd def extract(inpath): data = xlrd.open_workbook(inpath, encoding_override='utf-8') table = data.sheets()[0] # 选定表 nrows = table.nrows # 获取行号 ncols = table.ncols # 获取列号 for i in range(1, nrows): # 第0行为表头 alldata = table.row_values(i) # 循环输出excel表中每一行,即所有数据 result = alldata[6] # 取出表中第7列数据 print(result) inpath = './test.xls' # excel文件所在路径 extract(inpath)
python 中文名:蟒蛇,设计者:Guido van Rossum