Python List extend()方法
Python 教程
· 2019-02-02 21:41:49
描述
extend() 函数用于在列表末尾一次性追加另一个序列中的多个值(用新列表扩展原来的列表)。
语法
extend()方法语法:
list.extend(seq)
参数
- seq -- 元素列表。
返回值
该方法没有返回值,但会在已存在的列表中添加新的列表内容。
实例
以下实例展示了 extend()函数的使用方法:
#!/usr/bin/python aList = [123, 'xyz', 'zara', 'abc', 123]; bList = [2009, 'manni']; aList.extend(bList) print "Extended List : ", aList ;
以上实例输出结果如下:
Extended List : [123, 'xyz', 'zara', 'abc', 123, 2009, 'manni']
点击查看所有 Python 教程 文章: https://www.codercto.com/courses/l/8.html
Blockchain Basics
Daniel Drescher / Apress / 2017-3-16 / USD 20.99
In 25 concise steps, you will learn the basics of blockchain technology. No mathematical formulas, program code, or computer science jargon are used. No previous knowledge in computer science, mathema......一起来看看 《Blockchain Basics》 这本书的介绍吧!