'''
元组
1.元组是不可变的,不可添加不可删除,但是元组的内容是可更改的
2.元组中的数据是可变的;元组中通常代表一行数据,而元组中的数据代表不同的数据项
3.元组只有一个元素的时候,一定要加逗号,tulpe = (1,),不加逗号,类型不是元组
'''
tuple1 = (15,2,50,'abc',["username","password"],{"name":"xiaochao"})
print u'获取元素在元组中出现了几次:',tuple1.count(50)
print u'获取元素在元组中的索引:',tuple1.index(50)
'''
把元组中name对应的小超改为admin
'''
tru = 'admin'
tuple1[5]['name'] = tru
print tuple1
#取出元组中具体的值
print u'取出元组中具体的值:',tuple1[3]
#取出元组最后一位元素
print u'取出元组中最后一个元素的值:',tuple1[len(tuple1)-1]
#切片在元组中的使用
print u'切片在元组中的使用:',tuple1[0:4]
#使用循环的方式,取出元组中所有的值
for item in tuple1:
print u'循环获取元组中的所有值:', item
#获取元组中的某个元素在元组中的个数
print u'获取元组中某个元素的个数:',tuple1.count('xiaochao')
#修改元组嵌套在元组中的列表内容
print u'元组中的内容:', tuple1
tuple1[5]['username']='admin'
print u'元组中的字典被修改后的内容L:',tuple1,u'类型为:',type(tuple1)
# print 2<1 or 2>1#or是或运算,只要其中有一个为true结果就是true
# print 2>1 and 4>9#and是与运算,只有所有的都为true结果才为true
# print not 3>5#not运算是非运算,把true变成false,false变为true
# print None#空值,不能理解为0,它是特殊得空值
# user = 'what is yong'
# print user.__len__()#查看字符串长度
# listUser = [1,'de',23]
# print len(listUser)