Python---tuple

'''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)

 


posted @ 2015-12-28 20:06  xfei.zhang  阅读(137)  评论(0编辑  收藏  举报