有时候用到这个模块的时候会报错

"AttributeError: 'CNAME' object has no attribute 'address'"

如图所示

dnspython模块报错

代码是这样的

dnspython模块报错

我们只需在最后需要输出address时在前面增加if判断

if j.rdtype == 1: 

将代码修改如图:

dnspython模块报错

运行就不会报错了

dnspython模块报错


相关文章: