Python: How to add data to the dictionary

Assign directly 

data= {'name':'AI','age':'1024'}
#执行以下代码
data['update_date'] = '2020-10-24'
print(data)
#输出结果
{'name':'AI','age':'1024','update_date':'2020-10-24'}

 

Guess you like

Origin blog.csdn.net/weixin_38676276/article/details/107517538