【发布时间】:2017-08-23 07:13:59
【问题描述】:
让我们假设 a=0,b=1....,z=25,aa=26,...等等。
我如何在 python 中形成一个列表来查找任何给定字母表的索引,假设是 ey?
book = xlrd.open_workbook(input("Enter name of the excel file "))
table_list=list(book.sheet_names())
print("the sheets in the excel file are :")
for name in table_list:
print(name)
first_sheet = book.sheet_by_index(table_list.index(input("Enter sheet name ")))
arrayofvalues = first_sheet.col_values(152,2,239)
我需要在col_val函数中使用得到的值。
还有其他方法吗?
【问题讨论】:
-
从字母迭代到 Excel 表格操作,您真正想做的是什么?
-
最好是做一些数学运算,然后提出一个计算索引的函数,而不是用
list所有这些我>
标签: python list loops xlrd pyexcel