元组

>>> tup1 = (1,2,3)
>>> tup2 = tup1*2
>>> tup2
(1, 2, 3, 1, 2, 3)
>>> tup3 = tup1 + tup2
>>> del tup1
>>> tup1
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
tup1
NameError: name 'tup1' is not defined

>>> tup1 = (1,)
>>> tup1
(1,)
>>> tup1 = tup1 + tup2
]
>>> tup1
(1, 1, 2, 3, 1, 2, 3)
>>> max (tup1)
3
>>> min (tup1)
1
>>> len (tup1)
7
>>>
>>> list1 = ['a','f']
>>> tup3 = tuple(list1)
>>> tup3
('a', 'f')
>>>

原文地址:https://www.cnblogs.com/xuanbjut/p/11256916.html