当前位置: 代码迷 >> 综合 >> 将excel中某列不连续的数字批量转换为python数组list
  详细解决方案

将excel中某列不连续的数字批量转换为python数组list

热度:28   发布时间:2024-03-07 13:58:26.0
import xlrd as xd
data =xd.open_workbook ('1.xlsx') #打开excel表所在路径
sheet = data.sheet_by_name('Sheet1')  #读取数据,以excel表名来打开
d = []
for r in range(sheet.nrows): #将表中数据按行逐步添加到列表中,最后转换为list结构data1 = []for c in range(sheet.ncols):data1.append(sheet.cell_value(r,c))d.append(list(data1))print(d)
  相关解决方案