编程语言
首页 > 编程语言> > 第二周-第08章节-Python3.5-列表的使用2

第二周-第08章节-Python3.5-列表的使用2

作者:互联网

names=["张三","李四","王二","零度雨",["小列表1","小列表2"],"深海","赵云","张三丰"]
names2=names.copy()   #浅copy
names[4][0]="里面的小列表"
names[2] = "王小二"
print(names)
print(names2)
import copy   #导入标准库
names2=copy.deepcopy(names) #深copy
names[2] = "王小二"
print(names)
print(names2)


names=["张三","李四","王二","零度雨",["小列表1","小列表2"],"深海","赵云","张三丰"]
# 列表的循环
for i in (names):
print (i)

 

标签:names2,王小二,08,列表,Python3.5,第二周,names,print,copy
来源: https://www.cnblogs.com/pcjbk/p/10947071.html