Should I use 'has_key()' or 'in' on Python dicts?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
797
94
I wonder what is better to do: d = {'a': 1, 'b': 2} 'a' in d True or: d = {'a': 1, 'b': 2} d.has_key('a') True
python dictionary
share | improve this question
edited Nov 29 '18 at 6:37
smci
15.6k 6 79 109
asked Aug 24 '09 at 16:30
...