为什么xlrd不能把99以上的数字记录下来?

2024-09-29 23:19:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我是python新手,正在尝试从xlsx表导入

使用xldr模块,但当它达到100时出错

当我拨打高于[99]的号码时,我得到一个键错误

我现在无法读懂数字,因为它给出了一个'100':'100'而不是 100:100就像其他核弹手做的99:99一样

import xlrd

loc = ("c:/exel/loopline.xlsx")


workbook = xlrd.open_workbook(loc)
sheet = workbook.sheet_by_index(0)

sheet.cell_value(0,0)

lusnummer = {}


for i in  range(3,140):


    cell_value_id2 = sheet.cell(i,1).value
    cell_value_lusnummer = sheet.cell(i,1).value
    lusnummer[cell_value_id2] = cell_value_lusnummer

print(lusnummer)

输出如下所示:

, 99.0: 99.0, '100': '100',

我现在想知道我做错了什么


Tags: 模块value错误cell数字xlsxloc号码

热门问题