[docs] list.insert(i,x) behavior

pankaj garg kasturigarg at gmail.com
Mon Jan 12 10:28:41 CET 2015


Hi Sir/Madam

I am trying following stuff with lists.

*Line 1* >>> a = [1,2,3,4,5]
*Line 2* >>> a.insert(5,6)
*Line 3* >>> a
*Line 5*        [1,2,3,4,5,6]
*Line 6* >>> a.insert(9,9)
*Line 7* >>> a
*Line 8*        [1,2,3,4,5,6,9]

Output shouldn't be [1,2,3,4,5,6,0,0,0,9] as index specified is *index = 9*

I checked this on *Python 3.4.2*

Regards
Pankaj Garg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20150112/ed6671b4/attachment.html>


More information about the docs mailing list