Python3 List append()方法

Python 3 教程 · 2019-02-06 12:14:42

描述

append() 方法用于在列表末尾添加新的对象。

语法

append()方法语法:

list.append(obj)

参数

  • obj -- 添加到列表末尾的对象。

返回值

该方法无返回值,但是会修改原来的列表。

实例

以下实例展示了 append()函数的使用方法:

#!/usr/bin/python3

list1 = ['Google', 'Codercto', 'Taobao']
list1.append('Baidu')
print ("更新后的列表 : ", list1)

以上实例输出结果如下:

更新后的列表 :  ['Google', 'Codercto', 'Taobao', 'Baidu']

点击查看所有 Python 3 教程 文章: https://www.codercto.com/courses/l/10.html

查看所有标签

Data Structures and Algorithm Analysis in Java

Data Structures and Algorithm Analysis in Java

Mark A. Weiss / Pearson / 2011-11-18 / GBP 129.99

Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course wa......一起来看看 《Data Structures and Algorithm Analysis in Java》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

MD5 加密
MD5 加密

MD5 加密工具

html转js在线工具
html转js在线工具

html转js在线工具