[Tutor] mixed tuples and lists to nested lists
kevin parks
kp87@lycos.com
Fri, 20 Jul 2001 05:27:01 +0900
Here is a problem i come up against frequently and i guess i should know this by
now, but i don't. Some times if you fiddle around with things you end up with a list
whose list elements contain not only lists, but nested lists, and *gasp*
those Beckett-esque immutable tuples.
An example might be:
[(1, 100, 'w'), (2, 101, 'x'), (3, 102, 'y'), (4, 103, 'z')]
how do i change that to be:
[[1, 100, 'w'], [2, 101, 'x'], [3, 102, 'y'], [4, 103, 'z']]
A pathalogical example would be to turn something like
this in to a list of lists:
['abc',[(1,2), ([3],4)],5]
cheers,
back to the interpreter
kevin
Get 250 color business cards for FREE!
http://businesscards.lycos.com/vp/fastpath/