dict 嵌套

dic1 = {
'name':['alex','wusir'],
'py9':
{
'time':'1213',
'learn_money':'19800',
'address':'CBD',
},
'age':21
}

dic1['age'] = 56
dic1['name'].append('日天')
dic1['name'][1] = 'WUSIR'
dic1['name'][1] = dic1['name'][1].upper()
print(dic1)

#dic1['py9']['female'] = 6
dic1['py9'].setdefault('femate',6)
print(dic1)

info = input('>>>>') #hkh1jkj33232kjk121232jkk212121313
for i in info:
if i.isalpha():
info = info.replace(i,' ')
l = info.split()
print(len(l))
posted @ 2018-10-21 14:52  Feng_fu  阅读(64)  评论(0编辑  收藏  举报