login_DB = [{'ID' : 'xg3571', 'password' : '1234'},
{'ID': 'elliot', 'password' : 'fake1234'},
{'ID': 'sweetrin', 'password' : 'lovelive'}
]
member = {'ID' : 'xg3571', 'password' : '1234'}
I want to find the dictionary in login_DB, which has same 'ID' key of member, comparing dictionary.
login_account = ...
if login_account == member:
return True
else:
return False
I want more pythonic code than this:
login_account = next(dic for dic in login_DB if dic['ID'] == member['ID'])