使用通常的python,openpyxl库工作正常,但在我的情况下我被迫使用IronPython(2.7.3)。一开始
from openpyxl import Workbook
wb = Workbook()
ws = wb.active
ws['A1'] = 42
wb.save("D:/Test/result1.xlsx")
我得到了
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files (x86)\IronPython.2.7\Lib\site-packages\openpyxl\workboo
k\workbook.py", line 367, in save
File "C:\Program Files (x86)\IronPython.2.7\Lib\site-packages\openpyxl\writer\
excel.py", line 284, in save_workbook
File "C:\Program Files (x86)\IronPython.2.7\Lib\site-packages\openpyxl\writer\
excel.py", line 266, in save
File "C:\Program Files (x86)\IronPython.2.7\Lib\site-packages\openpyxl\writer\
excel.py", line 73, in write_data
File "C:\Program Files (x86)\IronPython.2.7\Lib\site-packages\openpyxl\writer\
workbook.py", line 36, in write_root_rels
File "C:\Program Files (x86)\IronPython.2.7\Lib\site-packages\openpyxl\packagi
ng\relationship.py", line 67, in append
TypeError: 'Sequence' object is not subscriptable
我找到了这篇文章,但我无法弄清楚它在我的案例中会有什么帮助: TypeError: 'generator' object is not subscriptable, csv file