[英]taking data from .xls file to python list
Open the workbook 打开工作簿
import xlrd
wb = xlrd.open_workbook('/home/AlAhAb65/Desktop/Parameter.xls')
Check the sheet names 检查工作表名称
wb.sheet_names()
Get the first sheet either by name 按名称获取第一张纸
sh = wb.sheet_by_name('QA_TEST')
l = []
Iterate through rows, returning each as a list that you can index: 遍历行,将每行作为可索引的列表返回:
for rownum in range(sh.nrows):
l.append(sh.row_values(rownum))
print l
When I am reading from excel to python list there always come 'u' before every data. 当我从excel读取到python列表时,总是在每个数据之前出现“ u”。 How can I get rid of this? 我该如何摆脱呢? Is everything read as string? 一切都读为字符串吗? Do I have to convert every time? 我每次都要转换吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.