Referencing Items in a List of Tuples

rshepard at nospam.appl-ecosys.com rshepard at nospam.appl-ecosys.com
Sun Feb 25 19:33:52 EST 2007


On 2007-02-25, Paddy <paddy3118 at googlemail.com> wrote:

> You might also use list comprehensions to accumulate the values you
> need:
>
> ec = [ item[2:]  for item in mainlist  if item[:2] == ['eco','con'] ]

  Thank you, Paddy. That's the syntax I couldn't work out myself.

Rich



More information about the Python-list mailing list