我正在使用openpyxl模块从.xlsx文件读取数据。我有一个包含多行的单元格,我想知道是否可以仅打印第二行的值。
我正在使用,print sheet.cell(row=6, column=2).value但它会打印所有行。
print sheet.cell(row=6, column=2).value
谢谢
这是Python中的标准字符串处理:
text = sheet.cell(row=6, column=2).value lines = text.splitlines() print(lines[1])
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
点击生成二维码
我来说两句