标签:tuple 合数 mic 增删改 .com 实例 com ems 类型
d = {‘Bob‘: 75, ‘Michael‘: 95, ‘Tracy‘: 85} #zeng d[‘Tom‘]=88 print(d) #del d.pop(‘Michael‘) print(d) del(d[‘Tracy‘]) print(d) #gai d[‘Tom‘]=90 print(d) #cha print(d.get(‘Bob‘)) print(d.keys()) print(d.get(‘Michael‘,66)) print(d.values()) print(d.items()) print(d.pop(‘Bob‘,55))
列表,元组,字典,集合的遍历。
l=list(‘1124564641321564‘) t=tuple(‘124856421574212‘) s=set(‘121542121213210‘) d=[‘Bob‘, ‘Tom‘] i=[75, 90] di=dict(zip(d,i)) for i in l: print(i,end=‘/‘) print() for i in t: print(i,end=‘/‘) print() for i in s: print(i,end=‘/‘) print() for i in di: print(i,di[i])
标签:tuple 合数 mic 增删改 .com 实例 com ems 类型
原文地址:http://www.cnblogs.com/Qzlhxxx/p/7595953.html