[Tutor] nested list query

Vikram K kpguy1975 at gmail.com
Mon Jun 27 23:07:43 CEST 2011


Suppose i have the following nested list:

>>> x
[['19600894', '1', 'chr15_76136768', 'MISSENSE'], ['19600894', '2',
'chr15_76136768', 'MISSENSE'], ['18467762', '1', 'chr14_23354066',
'MISSENSE']]


How do i obtain from nested list x (given above), the following nested list
z:

>>> z
[['chr15_76136768', 'MISSENSE'], ['chr14_23354066', 'MISSENSE']]


------
In other words, if the third element of an element of x is the same, then i
wish to combine it into a single element.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110627/d16941b0/attachment.html>


More information about the Tutor mailing list