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://codercto.com/courses/l/8.html

查看所有标签

Introduction to Semi-Supervised Learning

Introduction to Semi-Supervised Learning

Xiaojin Zhu、Andrew B. Goldberg / Morgan and Claypool Publishers / 2009-6-29 / USD 40.00

Semi-supervised learning is a learning paradigm concerned with the study of how computers and natural systems such as humans learn in the presence of both labeled and unlabeled data. Traditionally, le......一起来看看 《Introduction to Semi-Supervised Learning》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具