我的 Excel 文件中有三列,我必须使用 xlrd 将前两列的所有行转换为字典。
预期输出:
{'Sam' : 'Tester', 'John' : 'Developer', 'Fin' : 'Tester'}
Run Code Online (Sandbox Code Playgroud)

for i in range(1, worksheet.nrows):
row = worksheet.row_values(i)
variable = row[0] + row[1]
print(" {0} {1}".format(row[0],format(row[1])))
print(variable)
Run Code Online (Sandbox Code Playgroud)
该代码打印前两列。如何转换为字典类型?