no message

This commit is contained in:
yinjun.chen1
2026-10-10 17:30:24 +08:00
parent f73d5deacb
commit 9af18aeb35
9 changed files with 75 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
contacts = {
'name':'张三',
'sex':"男",
'salary':'8000'
}
print(contacts.pop('name')) # 删除键值对,返回值
del contacts['sex'] # 删除键值对
print(contacts)
# pop能返回被删除的值,而del不能返回被删除的值
# pop()能指定默认值,而del不能指定默认值