web hosting and development forums
Web Design and Development Forums Archive


Index - Python programming forum

TypeError 'generator' object is unsubscriptable


Post reply

Pls help.
I get this error:
TypeError 'generator' object is unsubscriptable
ion an example like this:
[code:1]a = b[0][/code:1]
What is a generator and how do I get the vales I need from it?
Thank you
That's because the [color=green]b[/color] variable can be a tuple.
What you can do to access the values in variable b is
create a new massive with it's contents.
example:
[code:1]massive = []
for x in b:
massive.append(x)
a = massive[0][/code:1]




Dubai Forum | Paris Forum | Webmaster Forum | Vegan Forum | Brisbane Forum | 3D Forum | Jobs in Dubai | Jobs in London | London UK Classifieds
Archive script by RedHo.com