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

查看所有标签

A Guide to Monte Carlo Simulations in Statistical Physics

A Guide to Monte Carlo Simulations in Statistical Physics

Landau, David P./ Binder, Kurt / Cambridge Univ Pr / 2005-9 / 786.00元

This new and updated edition deals with all aspects of Monte Carlo simulation of complex physical systems encountered in condensed-matter physics, statistical mechanics, and related fields. After brie......一起来看看 《A Guide to Monte Carlo Simulations in Statistical Physics》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

URL 编码/解码
URL 编码/解码

URL 编码/解码