'''help---tuple
1. can not change
2. only can access
'''
my_tuple=('data1',222,222,'data3',333,444,'jang')
print(my_tuple)
print(my_tuple[0])
print(my_tuple[0:])
print(my_tuple[:-1])
print(my_tuple[:])
print(len(my_tuple))
print(my_tuple.count(222))
print(my_tuple.index(222))
print('data3' in my_tuple)
a_list = [111,'value']
print(tuple(a_list))
n_tuple=()
if n_tuple:
print('True')
else:
print('False')
w_tupe=(0,1,2,3,4,5,6)
(Sun,Mon,Tue,Wed,Thu,Fri,Sat)=w_tupe
print(Mon)
print(Thu)
Python---tuple
最新推荐文章于 2023-04-21 10:48:50 发布