python判断字典值或键在不在字典里
2021-06-04 06:02
阅读:609
标签:key dict value int one ict for break bre `dict1={‘name‘:‘Lara‘,‘age‘:18} for one in dict1: for one in dict1: python判断字典值或键在不在字典里 标签:key dict value int one ict for break bre 原文地址:https://www.cnblogs.com/jayzhao/p/14664111.html判断键在不在字典中
if ‘name‘ in dict1:#或dict1.keys()
print(‘key在字典中!‘)
break判断值在不在字典中
if ‘Lara‘ in dict1.values():
print(‘value在字典中!‘)
break`
上一篇:c++中虚函数的默认值
下一篇:冒泡排序
评论
亲,登录后才可以留言!