报错 'dict' object has no attribute 'has_key'

has_key方法在python2中是可以使用的,在python3中删除了。

比如:

if dict.has_key(word):

改为:

if word in dict:

posted @ 2017-05-04 15:48  StephenJusky  阅读(34095)  评论(1)    收藏  举报