[python-uk] nested list help

Vikram K kpguy1975 at gmail.com
Tue Jul 27 15:32:35 CEST 2010


Suppose i have this nested list:

>>> x
[['NM100', 3, 4, 5, 6, 7], ['NM100', 10, 11, 12, 13], ['NM200', 15, 16, 17]]
>>> for i in x:
...   print i
...
['NM100', 3, 4, 5, 6, 7]
['NM100', 10, 11, 12, 13]
['NM200', 15, 16, 17]
>>>

how do i obtain from the above the following nested list:

>>> z
[['NM100', 3, 4, 5, 6, 7, 10, 11, 12, 13], ['NM200', 15, 16, 17]]
>>> for i in z:
...   print i
...
['NM100', 3, 4, 5, 6, 7, 10, 11, 12, 13]
['NM200', 15, 16, 17]
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-uk/attachments/20100727/46300cb5/attachment.html>


More information about the python-uk mailing list