Python3 List copy()方法

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

描述

copy() 函数用于复制列表,类似于 a[:]。

语法

copy()方法语法:

list.copy()

参数

  • 无。

返回值

返回复制后的新列表。

实例

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

#!/usr/bin/python3

list1 = ['Google', 'Codercto', 'Taobao', 'Baidu']
list2 = list1.copy()
print ("list2 列表: ", list2)

以上实例输出结果如下:

list2 列表:  ['Google', 'Codercto', 'Taobao', 'Baidu']

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

查看所有标签

Pro Git

Pro Git

Scott Chacon / Apress / 2009-8-27 / USD 34.99

Git is the version control system developed by Linus Torvalds for Linux kernel development. It took the open source world by storm since its inception in 2005, and is used by small development shops a......一起来看看 《Pro Git》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

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

html转js在线工具