代码拉取完成,页面将自动刷新
import xlrd
print (xlrd.__file__)
#----------------------------------------------------------------------
def open_file(path):
"""
Open and read an Excel file
"""
book = xlrd.open_workbook(path)
# print number of sheets
print (book.nsheets)
# print sheet names
print (book.sheet_names())
# get the first worksheet
first_sheet = book.sheet_by_index(0)
# read a row
print (first_sheet.row_values(0))
# read a cell
cell = first_sheet.cell(0,0)
print (cell)
print (cell.value)
# read a row slice
print (first_sheet.row_slice(rowx=0,
start_colx=0,
end_colx=2))
#----------------------------------------------------------------------
if __name__ == "__main__":
path = "worksheet1.xlsx"
open_file(path)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。