1
hanai 2013-10-08 23:03:13 +08:00 1
|
2
hanai 2013-10-08 23:12:55 +08:00
呃,错了。
|
5
vmebeh 2013-10-08 23:29:59 +08:00
>>> i[:]==i
True |
6
farseerfc 2013-10-08 23:31:15 +08:00 3
區別用以下例子可以說清楚:
>>> l = [1,2,3] >>> r = l >>> a = [4] >>> l [1, 2, 3] >>> r [1, 2, 3] >>> a [4] >>> l[:]=a >>> l [4] >>> r [4] >>> l = [1,2,3] >>> r = l >>> a = [4] >>> l = a >>> l [4] >>> r [1, 2, 3] >>> l = [1,2,3] >>> l[1:3] = a >>> l [1, 4] 針對區段的賦值是可以替換整個區段的。 |
8
roricon 2013-10-09 10:51:50 +08:00
我擦还能这么写,又学到了
|