我想使用 python 从 Excel_file1、Sheet1、第 7 行中读取单行,有什么帮助吗?
请您参考如下方法:
首先安装xlrd
pip install xlrd
然后打开python文件
import xlrd
# Give the location of the file
loc = ("path of file")
# To open Workbook
wb = xlrd.open_workbook(loc)
sheet = wb.sheet_by_index(0)
print(sheet.row_values(7))
location是相对路径不是绝对路径
要了解有关 xlrd 及其用法的更多信息,请访问 https://xlrd.readthedocs.io/en/latest/
快乐编码。
