AttributeError: 'dict' object has no attribute 'has_key'

if not(planned_path.has_key(obj)):

在python2中对于一个dict,可以用dict.has_key(key_name)检测键是否存在,但是在python3中这种方法已近被弃用了。我们采用如下方法:

if obj not in planned_path:

猜你喜欢

转载自blog.csdn.net/weixin_39059031/article/details/82078931