def get_inner_ip(self):
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname) //获取公网IP
ipList = socket.gethostbyname_ex(hostname) //获取IP列表(内网+外网IP)
for i in ipList[2]: #获取内外IP
if(i[:3]=="172" or i[:3]=="192" or i[:3]=="10."):
self.IP=i
图片.png