Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- spisok=[{'a':'1','b':'2'},{'a':'3','b':'4'}]
- for i in range(len(spisok)):
- if spisok[i]['a'] == stroka_poiska:
- print('True')
- def chk_for_val(lst, key, val):
- for d in lst:
- if d.get(key) == val:
- return True
- return False
- In [138]: chk_for_val(lst, 'a', '3')
- Out[138]: True
- In [139]: chk_for_val(lst, 'X', '3')
- Out[139]: False
- for i in range(len(spisok)):
- for key in spisok[i]:
- if spisok[i][key]=='4':
- print(spisok[i][key])
Add Comment
Please, Sign In to add comment