问题:AttributeError: ‘dict’ object has no attribute ‘has_key’ 原因 :python版本兼容问题。has_key方法在python2中是可以使用的,在python3中删除了。 比如: if dict.has_key(word): 改为: if word in dict: