Learn Python 009: Dictionary
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Learn Python 009: Dictionary相关的知识,希望对你有一定的参考价值。
# create a dictionary students = {"Alice": 24, "Bob": 26, "Clark": 23, "Dan": 28, "Emma": 31} # add entry to a dictionary students[‘Fred‘] = 27 # alter an entry students[‘Alice‘] = 25 # delete entry del students[‘Fred‘] students2 = { "Alice": [‘ID01‘, 24, ‘A-‘], "Bob": [‘ID02‘, 26, ‘B+‘], "Clark": [‘ID03‘, 23, ‘B‘], "Dan": {‘id‘: ‘ID04‘, ‘age‘: 28, ‘grade‘: ‘A‘}, }
以上是关于Learn Python 009: Dictionary的主要内容,如果未能解决你的问题,请参考以下文章