在导入socket模块后报错:
AttributeError: ‘module’ object has no attribute ‘AF_INET’
因为用import导入模块是根据文件名字导入的,在学习的时候这正好用socket来命名了这个 .py 文件,导致错误的出现。
尽量避免自己写的py文件和模块名字相同
在导入socket模块后报错:
AttributeError: ‘module’ object has no attribute ‘AF_INET’
因为用import导入模块是根据文件名字导入的,在学习的时候这正好用socket来命名了这个 .py 文件,导致错误的出现。
尽量避免自己写的py文件和模块名字相同