excel - data extraction from xls using xlrd in python -
excel - data extraction from xls using xlrd in python -
i trying extract info .xls file , making list getting list [u'elem1', u'elem2', u'elem3']
, if print separately as:
elem1 elem2 elem3
what u thing , how remove it?
here code...
from xlrd import open_workbook xls=open_workbook('name.xls') sheets in xls.sheets(): list1=[] col in range(sheets.ncols): rows in range(sheets.nrows): list1.append(sheets.cell(rows, col).value) print(list1) in list1: print(i)
you can define text string,while appending info list in list1.append(str(sheets.cell(rows, col).value)) remove [u' .the code be:
xlrd import open_workbook xls=open_workbook('name.xls') sheets in xls.sheets(): list1=[] col in range(sheets.ncols): rows in range(sheets.nrows): list1.append(str(sheets.cell(rows, col).value)) print(list1) in list1: print
python excel list xlrd
Comments
Post a Comment