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 Django

Pro Django

Marty Alchin / Apress / 2008-11-24 / USD 49.99

Django is the leading Python web application development framework. Learn how to leverage the Django web framework to its full potential in this advanced tutorial and reference. Endorsed by Django, Pr......一起来看看 《Pro Django》 这本书的介绍吧!

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

在线压缩/解压 CSS 代码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

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

html转js在线工具