新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
python中的insert怎么用?
描述
成都網(wǎng)絡公司-成都網(wǎng)站建設公司創(chuàng)新互聯(lián)10余年經(jīng)驗成就非凡,專業(yè)從事做網(wǎng)站、成都網(wǎng)站制作,成都網(wǎng)頁設計,成都網(wǎng)頁制作,軟文發(fā)布平臺,一元廣告等。10余年來已成功提供全面的成都網(wǎng)站建設方案,打造行業(yè)特色的成都網(wǎng)站建設案例,建站熱線:18980820575,我們期待您的來電!
insert() 函數(shù)用于將指定對象插入列表的指定位置。
語法
insert()方法語法:
list.insert(index, obj)
參數(shù)
index -- 對象 obj 需要插入的索引位置。
obj -- 要插入列表中的對象。
返回值
該方法沒有返回值,但會在列表指定位置插入對象。
實例
以下實例展示了 insert()函數(shù)的使用方法:
#!/usr/bin/python aList = [123, 'xyz', 'zara', 'abc'] aList.insert( 3, 2009) print "Final List : ", aList
以上實例輸出結果如下:
Final List : [123, 'xyz', 'zara', 2009, 'abc']
以上就是python中insert用法是什么的詳細內(nèi)容,更多請關注創(chuàng)新互聯(lián)其它相關文章!
網(wǎng)站題目:python中的insert怎么用?
當前鏈接:http://fisionsoft.com.cn/article/ihcoic.html