问题:
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
解决方案:
参考一:https://stackoom.com/question/5YHK/我应该在Python-dicts上使用-has-key-或-in-吗参考二:https://oldbug.net/q/5YHK/Should-I-use-has-key-or-in-on-Python-dicts