Simple question from Python newb... What am I doing wrong? For x, y, z in aTuple:

Amy G amy-g-art at
Mon Jan 19 22:15:22 CET 2004

I have a whole bunch of tuples that look something like this,

aTuple = ('1074545869.6580.msg', 't_bryan_pw at', 'Your one stop

now that I have this I try

for x, y, z in aTuple:
    do something with x
    do something with y
    do something with z

But I am getting the error that there are too many values to unpack.
If I do...

for x in aTuple:
    print x

It prints the items from the tuple each on its own line.  How can I unpack
these three string values into three different string variables like my
first for loop?

Thanks in advance for answering what is probably a simple question.

More information about the Python-list mailing list