我正在尝试通过python脚本将.xlsx文件转换为json文件。
output['operators'] = {}
for y in range(marks[0][0]+1, marks[1][0]-2):
ops = [CTUs.get(o,o) for o in workbook.cell_value(y,2).split('/')]
for op in ops:
if not op in list(output['operators']):
output['operators'][op] = {
'name':op,
'guns':[]
}
name = workbook.cell_value(y,2)
output['operators'][op]['guns'].append(name if name != 417 else '417') #Dry this code later
在第十行('guns':[]
)上,出现类型错误:TypeError: unhashable type: 'list'
。我不知道为什么和AFAIK,键是唯一需要哈希的部分。