[Tutor] List of tuples
Danny Yoo
dyoo at hashcollision.org
Tue Apr 19 18:01:41 EDT 2016
On Tue, Apr 19, 2016 at 1:56 PM, isaac tetteh <itetteh34 at hotmail.com> wrote:
> I have a list like this
> [
> ("name",2344,34, "boy"),("another",345,47,"boy", "last")
> ]
> How do u get each value from it like
> Output
> name
> 2344
> 34
> ...
>
> What i did was
> for row in list_tuple:
> for row2 in row:
> return row
>
> But i get error too many value to unpack
Hi Issac,
Can you copy and paste the exact error message and stack trace that
you're seeing? Try not to paraphrase it: we need to see exactly the
text is saying. In some cases, we'll even pay attention to whitespace
and other insanely silly details. :P
Since that's tedious for you to retype, just use copy-and-paste.
Include everything that the error message says, even if it doesn't
make sense to you. We'll try to help you interpret what the error is
saying. Unfortunately, you paraphrased the error message above too
much: I have no good guesses from what you've presented so far.
Also, try to show the entire program that you ran as well. The
snippet you showed us is incomplete, because we don't know how the
program defines "list_tuple". Generally, you want to include enough
detail when asking for help that it's really easy for the tutors here
to "reproduce" your problem. That way, we can see the same problem
that you see. That's important.
My best guess so far, from all that you've shown us, is that a
*different* part of the program is responsible for the error you're
showing us. That's why we need more details: I think something else
other than what you're showing us is producing that error. The reason
I think so is because no part of the program you're showing us is
doing tuple unpacking, at least from what I can tell.
More information about the Tutor
mailing list