Skip to content

Commit 306de7f

Browse files
committed
Signed-off-by: twowater <[email protected]>
1 parent 281ef9a commit 306de7f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

python3/tuple.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,22 @@ print(tuple2[0])
5858

5959
具体看下面的这个例子:
6060

61-
![修改 tuple](https://dn-mhke0kuv.qbox.me/f7c65a3eac93c144fb4e.png)
61+
```python
62+
#-*-coding:utf-8-*-
63+
list1=[123,456]
64+
tuple1=('两点水','twowater','liangdianshui',list1)
65+
print(tuple1)
66+
list1[0]=789
67+
list1[1]=100
68+
print(tuple1)
69+
```
70+
71+
输出的结果:
72+
```
73+
('两点水', 'twowater', 'liangdianshui', [123, 456])
74+
('两点水', 'twowater', 'liangdianshui', [789, 100])
75+
```
76+
6277

6378
可以看到,两次输出的 tuple 值是变了的。我们看看 tuple1 的存储是怎样的。
6479

0 commit comments

Comments
 (0)