本帖最后由 wongyusing 于 2018-9-7 09:56 编辑
不用numpy的情况一样的,都会是改变a的值
- Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56)
- [GCC 7.2.0] on linux
- Type "help", "copyright", "credits" or "license" for more information.
- >>> a = [[1,2,3,4], [5,6,7,8], [9,10,11,12]]
- >>> print(a)
- [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
- >>> b = a
- >>> print(b)
- [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
- >>> b[0][0] = 44
- >>> print(b)
- [[44, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
- >>> print(a)
- [[44, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
复制代码 |