redho home | products | services

Programming Forums


Community for Java, PHP, Perl C, ASP and Python programmers
Wednesday 17 October 2018 13:57

Ask your IT question here

TypeError 'generator' object is unsubscriptable



 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Programming Forums -> Python programming forum
View previous topic :: View next topic  
Author Message
Nesh
Guest Programmer




Pls help.
I get this error:
TypeError 'generator' object is unsubscriptable

ion an example like this:
Code:
a = b[0]


What is a generator and how do I get the vales I need from it?

Thank you

Reply with quote
 
Madwolf
Site Admin


Joined: 22 Dec 2004
Posts: 77
That's because the b 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:
massive = []
for x in b:
     massive.append(x)
a = massive[0]

Reply with quote
 
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Programming Forums -> Python programming forum


Dubai Forums - Expat Help | Vegan Forum | Java Programming | 3d Design Resources | 3d Forum | 3D Jobs | 3D Textures | Paris Forum | Europe Forum
Dubai Classifieds | Dubai Property | Jobs in Dubai | Free London Classifieds | Jobs in London UK

High Quality, Custom 3d animation and Web Design solutions Royal Quality Web Hosting Services Vegetarian and Animal Rights news

© 2018 RedHo