| 打卡 >>> a=1,2,3,4,5,'ctx'
 >>> a
 (1, 2, 3, 4, 5, 'ctx')
 >>> a[0]
 1
 >>> a[-1]
 'ctx'
 >>> a[:]
 (1, 2, 3, 4, 5, 'ctx')
 >>> a[2:]
 (3, 4, 5, 'ctx')
 >>> a[:3]
 (1, 2, 3)
 >>> a[::3]
 (1, 4)
 >>> a[::-1]
 ('ctx', 5, 4, 3, 2, 1)
 >>> n=3,1,6,7,7,9,7,0,3,4
 >>> n
 (3, 1, 6, 7, 7, 9, 7, 0, 3, 4)
 >>> n.count(3)
 2
 >>> n.count(7)
 3
 >>> n.index(7)
 3
 >>> n.index(6)
 2
 >>> n.index(9)
 5
 >>> b=a,n
 >>> b
 ((1, 2, 3, 4, 5, 'ctx'), (3, 1, 6, 7, 7, 9, 7, 0, 3, 4))
 >>> for each in n:
 print(each)
 
 
 3
 1
 6
 7
 7
 9
 7
 0
 3
 4
 >>> for i in b:
 for each in i:
 print(each)
 
 
 1
 2
 3
 4
 5
 ctx
 3
 1
 6
 7
 7
 9
 7
 0
 3
 4
 >>> [each *2 for each in b]
 [(1, 2, 3, 4, 5, 'ctx', 1, 2, 3, 4, 5, 'ctx'), (3, 1, 6, 7, 7, 9, 7, 0, 3, 4, 3, 1, 6, 7, 7, 9, 7, 0, 3, 4)]
 >>> [each *2 for each in a]
 [2, 4, 6, 8, 10, 'ctxctx']
 >>> [each *2 for each in n]
 [6, 2, 12, 14, 14, 18, 14, 0, 6, 8]
 >>>  x=(1,)
 
 SyntaxError: unexpected indent
 >>> x=(1,)
 >>> x
 (1,)
 >>> type(x)
 <class 'tuple'>
 >>> t=a,b,n
 >>> t
 ((1, 2, 3, 4, 5, 'ctx'), ((1, 2, 3, 4, 5, 'ctx'), (3, 1, 6, 7, 7, 9, 7, 0, 3, 4)), (3, 1, 6, 7, 7, 9, 7, 0, 3, 4))
 >>> a,b,n=t
 >>> a
 (1, 2, 3, 4, 5, 'ctx')
 >>> b
 ((1, 2, 3, 4, 5, 'ctx'), (3, 1, 6, 7, 7, 9, 7, 0, 3, 4))
 >>> n
 (3, 1, 6, 7, 7, 9, 7, 0, 3, 4)
 >>> a,b,c,d,e="ctx"
 Traceback (most recent call last):
 File "<pyshell#273>", line 1, in <module>
 a,b,c,d,e="ctx"
 ValueError: not enough values to unpack (expected 5, got 3)
 >>> a,b,c="ctx"
 >>> a
 'c'
 >>> b
 't'
 >>> c
 'x'
 >>> "ctx"=a,b,c
 SyntaxError: cannot assign to literal
 >>> [1,2,3,4,5]=t
 SyntaxError: cannot assign to literal
 >>> y=[1,2,3,4,5]
 >>> z,x,c,v,m=y
 >>> z
 1
 >>> x
 2
 >>> c
 3
 >>> v
 4
 >>> m
 5
 >>> a,*b='ctx'
 >>> a
 'c'
 >>> b
 ['t', 'x']
 >>>
 >>> q=([1,3,6],[2,5,7])
 >>> q[2][2]=8
 Traceback (most recent call last):
 File "<pyshell#292>", line 1, in <module>
 q[2][2]=8
 IndexError: tuple index out of range
 >>> q
 ([1, 3, 6], [2, 5, 7])
 >>> q[2][2]
 Traceback (most recent call last):
 File "<pyshell#294>", line 1, in <module>
 q[2][2]
 IndexError: tuple index out of range
 >>> q[1][1]
 5
 >>> q[1][2]
 7
 >>> q[1][2]=11111
 >>> q
 ([1, 3, 6], [2, 5, 11111])
 >>> z,y=12,45
 >>> z
 12
 >>> y
 45
 >>> _=(12,45)
 >>> z,y=_
 >>> z
 12
 >>> y
 45
 |