【发布时间】:2019-01-20 16:23:52
【问题描述】:
现在我无法使用以下代码从 COM 和 Python 读取的 Excel 单元格中检索值:
from comtypes.client import CreateObject
filename=r'testrap.xlsx'
app = CreateObject("Excel.Application")
app.Visible = True
wb = app.Workbooks.Open(filename)
worksheet = wb.sheets(1)
for row in range(1,11):
data = worksheet.Cells(row,1).Value
print(data)
我总是得到
comtypes.client.lazybind.NamedProperty object at 0x....
打印在屏幕上而不是单元格的值。
我做错了什么?
【问题讨论】: