xlrd如何通过sheet.row()或sheet.col()从excle工作表存储数据

时间:2018-06-13 10:33:44

标签: python excel xlrd

我正在编写一个从excle工作表中导入数据的函数

def get_data_excel(path,sheet):
book=xlrd.open_workbook(path)       #opens the excle document
sheet=book.sheet_by_index(sheet-1)  #def. the sheet where the data are stored
nocol=5
data=[list() for f in range(nocol)] #creating a empty list where all collumns are stored as lists
for j in range(nocol):              #filling the emty lists in the list data
        data[j]=sheet.col(j)
return data

这将返回如下列表列表: [[text:' Oxygen',number:17,number:13],[text:' Nigrogen',number:12,number:10],...]

问题: 我在想,为什么会这样做以及如何使用日期的标签。 例如。只从列表中获取文本或仅获取数字......?

THX 数学

0 个答案:

没有答案