how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ?

length power elearn2014 at gmail.com
Thu Apr 10 01:14:49 EDT 2014


>>> x=["a","b",["c","d"],"e"]
>>> y=x[2]
>>> y
['c', 'd']
>>> x.insert(2,y[0])
>>> x
['a', 'b', 'c', ['c', 'd'], 'e']
>>> x.insert(3,y[1])
>>> x
['a', 'b', 'c', 'd', ['c', 'd'], 'e']
>>> del x[4]
>>> x
['a', 'b', 'c', 'd', 'e']
>>>
maybe there is a more smart way to do.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140410/d63053ff/attachment.html>


More information about the Python-list mailing list