How i can convert a list of,
>> print(row)
>> [text:'Data 1', text:'Data 27'] # this is list but i want a dic
to something like
>> print(row)
>> {'text':'Data 1', 'text':'data 27'} # this is how i want my list to be
i tried like every possible aswer that i found while googling this.
this is what i got when i write print(type(row[0]))
this is my full code
import xlrd
def readData(xlsxfilename):
workbook = xlrd.open_workbook(xlsxfilename, on_demand=True)
# Getting the first sheet in the file which should contain input data
worksheet = workbook.sheet_by_index(0)
max_nb_row = 0
max_nb_row = max(max_nb_row, worksheet.nrows)
# Getting data
i = 0
for row in range(max_nb_row):
if i is not 0: # skip the first row because it just contains: Data Column 1 Data Column 2
if row < worksheet.nrows:
calcScore(worksheet.row(row))
i += 1
# TODO: calculate the score
def calcScore(row):
print(type(row[0]))