Is it possible to add a key to a Python dictionary after it has been created?
(创建密钥后,是否可以向Python字典添加密钥?)
.add()
(它似乎没有.add()方法。)
d = {'key':'value'} print(d) # {'key': 'value'} d['mynewkey'] = 'mynewvalue' print(d) # {'mynewkey': 'mynewvalue', 'key': 'value'}
1.4m articles
1.4m replys
5 comments
57.0k users