taking data from .xls file to python list -
open workbook
import xlrd wb = xlrd.open_workbook('/home/alahab65/desktop/parameter.xls')
check sheet names
wb.sheet_names()
get first sheet either name
sh = wb.sheet_by_name('qa_test') l = []
iterate through rows, returning each list can index:
for rownum in range(sh.nrows): l.append(sh.row_values(rownum)) print l
when reading excel python list there come ‘u’ before every data. how can rid of this? read string? have convert every time?
the 'u' not part of string, comes before quotes , indicates unicode string, should fine.
also, may want have @ more recent openpyxl.
Comments
Post a Comment