使用Openpyxl和python3.5,我尝试使用下标从excel工作表中获取第一行,但我是一个错误.
# after getting filename
# after loading worksheet
# to get the first row of the worksheet
first_row = worksheet.rows[0]
# I get
Traceback (most recent call last):
File "<pyshell#54>", line 1, in <module>
first_row = phc_th_sheet.rows[1]
TypeError: 'generator' object is not subscriptable
Run Code Online (Sandbox Code Playgroud)
关于获取第一行,我也尝试过first_row =工作表.(row = 1)#和first_row = worksheet.rows [:1]
没有用.任何建议或openpyxl中没有的功能?我去过https://openpyxl.readthedocs.io/en/default/上的文档,但我发现没有什么有用的索引和选择行