11.列表:一个打了激素的数组3
列表的一些常用操作符比较操作符
https://img-blog.csdnimg.cn/2019071509565428.png
逻辑操作符
https://img-blog.csdnimg.cn/20190715095835696.png
连接操作符
https://img-blog.csdnimg.cn/20190715095948422.png
重复操作符
https://img-blog.csdnimg.cn/20190715100046988.png
成员关系操作符
https://img-blog.csdnimg.cn/20190715100120407.png
https://img-blog.csdnimg.cn/20190715101850185.png
关于分片“拷贝”概念的补充
https://img-blog.csdnimg.cn/20190715094652335.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMyODA5MDkz,size_16,color_FFFFFF,t_70
>>> dir(list)可查看所有列表的操作函数
https://img-blog.csdnimg.cn/20190715101932156.png
count()函数可计算列表中相同元素个数
https://img-blog.csdnimg.cn/20190715102831141.png
index()函数可索引列表元素
https://img-blog.csdnimg.cn/20190715103100475.png
reverse()将列表中元素倒序
https://img-blog.csdnimg.cn/20190715103627636.png
sort()将列表中元素从小到大排序
https://img-blog.csdnimg.cn/20190715103717131.png
关于分片“拷贝”概念的补充
https://img-blog.csdnimg.cn/20190715104411346.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMyODA5MDkz,size_16,color_FFFFFF,t_70
https://img-blog.csdnimg.cn/20190715104301173.png
https://img-blog.csdnimg.cn/2019071510432428.png
注:list13=list11相当于多了个指向列表的标签,list12 = list[:]是实实在在的拷贝
最后一句话我的见解:
list13 = list11 就是把地址和值一起拷贝到list13,而list13 = list11[:]只是拷贝了值。
顺便恭喜成为互助团队的一员! 坚持就是成功 warrenyan 发表于 2020-4-5 20:12
坚持就是成功
谢谢
页:
[1]