操作
字典内元素的个数
len
(
dic
)
判断字典中是否存在某个键
dic
=
{
"domain"
:
"csdn.net"
,
"expiry"
:
1561747176.199094
,
"httpOnly"
:
false
,
"name"
:
"dc_tos"
,
"path"
:
"/"
,
"secure"
:
false
,
"value"
:
"pttcq0"
}
if
'expiry'
in
dic
:
print
(
"存在"
)
https://www.cnblogs.com/xmnote/p/9334880.html
删除键值对
my_dict
=
{
"name"
:
"123"
,
"age"
:
123
}
del
my_dict
[
"name"
]
https://www.cnblogs.com/lowmanisbusy/p/9142199.html