Python List insert()方法
Python 教程
· 2019-02-02 22:11:25
描述
insert() 函数用于将指定对象插入列表的指定位置。
语法
insert()方法语法:
list.insert(index, obj)
参数
- index -- 对象 obj 需要插入的索引位置。
- obj -- 要插入列表中的对象。
返回值
该方法没有返回值,但会在列表指定位置插入对象。
实例
以下实例展示了 insert()函数的使用方法:
#!/usr/bin/python aList = [123, 'xyz', 'zara', 'abc'] aList.insert( 3, 2009) print "Final List : ", aList
以上实例输出结果如下:
Final List : [123, 'xyz', 'zara', 2009, 'abc']
点击查看所有 Python 教程 文章: https://www.codercto.com/courses/l/8.html
Computational Geometry
Mark de Berg、Otfried Cheong、Marc van Kreveld、Mark Overmars / Springer / 2008-4-16 / USD 49.95
This well-accepted introduction to computational geometry is a textbook for high-level undergraduate and low-level graduate courses. The focus is on algorithms and hence the book is well suited for st......一起来看看 《Computational Geometry》 这本书的介绍吧!