python中判断字典中是否存在某个键
python3 中采用 in 方法
1 #判断字典中某个键是否存在
2 arr = {"int":"整数","float":"浮点","str":"字符串","list":"列表","tuple":"元组","dict":"字典","set":"集合"}
3 #使用 in 方法
4 if "int" in arr:
5 print("存在")
6 if "float" in a...
转载
2019-10-06 10:31:28 ·
2589 阅读 ·
0 评论