28

Python字典dict的常用方法和函数-运维不粘锅

 3 years ago
source link: https://blog.51cto.com/xxy12345/2544446
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
dict={'name':'Joe','age':18,'height':60}clear,清空dict.clear()#运行结果{}pop,移除指定key的键值对并返回vlaue(如果没有该key,可返回指定值),popitem,默认移除最后一个键值对print(dict.pop('age'))print(dict)#结果18,{'

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK