list.insert

Emile van Sebille emile at fenx.com
Wed Jul 14 11:41:11 EDT 2010


On 7/14/2010 7:54 AM Eric J. Van der Velden said...
> Hi,
>
> I understand this:
>
>>>> l=[1,2,3]
>>>> l[1:2]=[8,9]
>>>> l
> [1,8,9,3]
>
> But how do you do this with list.insert?
>



 >>> l = [1,2,3,4]
 >>> l[1:2]=""
 >>> dummy = [l.insert(1,x) for x in reversed([8,9])]


Emile




More information about the Python-list mailing list