#!/user/bin/python# -*- coding:utf-8 -*-dic1 = {'age':24,'name':'zd','sex':'boy'}print(dic1)#增dic1['high'] = 175 #没有建就添加dic1['sex'] = 'boy1' #有建就修改print(dic1)dic1.setdefault('weight',232) #有的话不做任何操作m没有的话就添加print(dic1)#删print(dic1.pop('age'))#有返回值按键去删…
#!/user/bin/python# -*- coding:utf-8 -*-lis = [2,3,'k',['qwe',20,['k1',['tt','3','1']],89],'ab','adv']#tt变成大写.lis[3][2][1][0] = 'TT'print(lis)lis[3][2][1][0] = lis[3][2][1][0].upper()print(lis)…
#!/user/bin/python# -*- coding:utf-8 -*-tu = ('zs','ls','ww',[1,2,3,4,5,'zxcvb'],'zl')print(tu[3])print(tu[0:4])for i in tu: print(i)tu[3][5] = tu[3][5].upper()print(tu)tu[3].append('fdsfds')print(tu)…
#!/user/bin/python# -*- coding:utf-8 -*-li = [3,5,6546,6,8,324,2,1,34,5,6,7]# li.sort() #正向# print(li)# li.sort(reverse=True) #倒向# print(li)li.reverse()print(li)…
#!/user/bin/python# -*- coding:utf-8 -*-li = ['zs','ls','ww','zl','xx']l = len(li) #总数print(l)num = li.count('ww') #计数几个print(num)print(li.index('zl')) #索引位置#li =…
#!/user/bin/python# -*- coding:utf-8 -*-li = ['zs','ls','ww','zl','xx']li[0] = 'cxvb' #按索引位置print(li)li[0:3] = 'vcxzvcxz' #切片改print(li)…
#!/user/bin/python# -*- coding:utf-8 -*-li = ['zs','ls','ww','zl','xx']# del li[1:] #1到最后# print(li)del li[0:3] #顾头不顾尾print(li)…
#!/user/bin/python# -*- coding:utf-8 -*-li = ['zs','ls','ww','zl']# name = li.pop(1) #按索引位置删除有返回值# name1 = li.pop()#默认删除最后一个有返回值# print(name,name1,li)# li.remove('ls') #按指定位置删除# print(li)li.clear() #清空print(li)# del li# print(li)…
#!/user/bin/python# -*- coding:utf-8 -*-li = ['zd',[1,3,4,5,6],'ls','ww','zl']l1 = li[0]print(l1)l2 = li[1]print(l2)l3 = li[0:3]print(l3) #切片顾头不顾尾…