字典的嵌套
Posted hopelv
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了字典的嵌套相关的知识,希望对你有一定的参考价值。
dic = { ‘name‘:[‘alex‘,‘wusir‘,‘taibai‘], ‘py9‘:{ ‘time‘:‘1213‘, ‘learn_money‘:19800, ‘addr‘:‘CBD‘, }, ‘age‘:21 } # dic[‘age‘] = 56 # print(dic[‘name‘]) # dic[‘name‘].append(‘ritian‘) # l = [1,2,‘wusir‘] # l[2] = l[2].upper() # dic[‘name‘][1] = dic[‘name‘][1].upper() # print(dic) #female : 6 # dic[‘py9‘][‘female‘] = 6 # print(dic) # fhdklah123rfdj12fdjsl3 ‘ 123 12 13‘ info = input(‘>>>‘).strip() for i in info: if i.isalpha(): info = info.replace(i," ") l = info.split() print(len(l))
以上是关于字典的嵌套的主要内容,如果未能解决你的问题,请参考以下文章