标签:数据 -- coding odi 获取 err pytho open class
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)
标签:数据 -- coding odi 获取 err pytho open class
原文地址:https://www.cnblogs.com/lutt/p/12207857.html