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.
Showing posts with label generator. Show all posts
Showing posts with label generator. Show all posts
Subscribe to:
Posts (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 ...
-
When you begin to build your website, it's a very clever idea to organize your files and folders efficiently. You should have: A ...
-
When using openpyxl to load workbooks, ensure that your excel file is saved in the same folder as the .py file you are developing. import...
-
It is a very good idea when creating a new webpage to reset all styles for the browser. This ensures that all browsers are starting off on ...