Python之“引用”
来源:互联网 发布:淘宝网首页开衫中长 编辑:程序博客网 时间:2024/04/29 15:11
Python中有类似C语言的数组名的特性,叫做“引用”,本质上是变量的内存地址。这就比较容易理解了。
# reference.pyprint 'SimpleAssigment'shoplist=['apple','mango','carrot','banana']mylist =shoplistdel shoplist[0]print mylist,'is mylist'print shoplist,"is my shoplist"mylist=shoplist[:] #equal to make a copy for shaoplist ,and my list is new allocated memory#这个部分就等于mylist新建了个副本存储shoplist,对mylist的操作不会影响shoplist del mylist[0]print mylist,'is mylist'print shoplist,"is my shoplist"
输出结果为:SimpleAssigment['mango', 'carrot', 'banana'] is mylist['mango', 'carrot', 'banana'] is my shoplist['carrot', 'banana'] is mylist['mango', 'carrot', 'banana'] is my shoplistProcess finished with exit code 0
0 0
- Python之“引用”
- Python 参数传递之引用传递
- Python学习之库引用错误
- Python引用其他模块之sys.path
- Python垃圾回收之循环引用
- 【Python】引用
- python 引用
- Python 初体验之 对象的引用和拷贝
- Python学习之函数参数传递:传值 or 引用 ?
- Python之引用(可变与不可变数据类型)
- Python中的引用计数
- Python引用路径。
- python 共享引用
- 注意python中的引用
- python中的引用
- python的引用计数
- Python引用模块
- python 引用与拷贝
- 测试小故事15:BUG被拒
- 文章标题 HDU 1455 : Sticks(dfs+剪枝)
- Unity常用数据结构Queue(队列)
- 如何在后台运行 Linux 命令并且将进程脱离终端
- python Excel接口测试
- Python之“引用”
- linux下hadoop2.7.2安装笔记
- 【Gzip】Nginx开启Gzip压缩大幅提高页面加载速度
- 从数组中获取落单的数并打印输出
- Docker学习笔记二:安装Docker并管理镜像
- CvPoint及CvPoint2D32f
- CodeForces 593D Happy Tree Party
- js---闭包和面向对象编程
- (转)Android闪屏问题解决思路