[portland] Still Having List/Tuple Problems

Dylan Reinhardt python at dylanreinhardt.com
Thu Apr 17 01:37:30 CEST 2008


On Wed, Apr 16, 2008 at 3:23 PM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
>   While all the examples print the
>  right side item of each tuple, I need to interate through those for each
>  left side item.

Take another look at the second block I sent:

for key in grouper.keys():
        print key
        for value in grouper[key]:
              print '\t%s' % value

If you want to ensure you iterate over the keys in a particular order,
you could update that with:

for key in set([i[0] for i in my_tuple]):
        print key
        for value in grouper[key]:
              print '\t%s' % value

In what way is that not what you're looking for?


More information about the Portland mailing list