每个月天数31,28,31,30,31,30,31,31,30,31,30,31
完成以下操作:
1输出字典的键序列
2键值序列
3键值对序列
4获取键对应键值
5修改键对应键值
6创建新字典,更新到monthdays中
7删除键值对
monthdays={"Jan":31,"Feb":328,"Mar":31,"Apr":30,"May":31,"Jun":30,"Jul":31,"Aug":31,"Sep":30,
"Oct":31,"Nov":30,"Dec":31}
#输出字典的键
a=monthdays.keys()
print(a)
#字典的键值
b=monthdays.values()
print(b)
#键值对序列
c=monthdays.items()
print(c)
#获取键May对应的值
print("May对应的值是",monthdays["May"])
#修改键Feb的值为29
monthdays["Feb"]=29
print(monthdays["Feb"])
#创建一个新的字典,将其更新到字典Month days中
d={"a1":35,"a2":35}
monthdays.update(d)
print(monthdays)
#删除键为a1的键值对
monthdays.pop("a1")
print(monthdays)