Error in chapter 12, which produces the following "TypeError: 'generator' object is not subscriptable" for the code below.
>>> import openpyxl
>>> wb = openpyxl.load_workbook('example.xlsx')
>>> sheet = wb.active
>>> sheet = wb.active
>>> sheet.columns[1]
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
sheet.columns[1]
TypeError: 'generator' object is not subscriptable
>>>
RESOLUTION:
Create a list for the sheet.colums:
list(sheet.columns)[1] to overcome the generator error - outdated method since python 2 apparently.
Subscribe to:
Post Comments (Atom)
Web Development: Organizing Files and Folders
When you begin to build your website, it's a very clever idea to organize your files and folders efficiently. You should have: A ...
-
Continuing our journey through Automate the Boring Stuff with Python's excel lessons, we came across the get_column_letter and column_in...
-
Some words are reserved in JavaScript and cannot be used as variable names. Some common examples are: case catch for let private th...
-
When inserting images from the CC library in Adobe DreamWeaver, it's usually better to 'Download Linked' or Download Unlinked...
No comments:
Post a Comment