def get_inner_ip(self):
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname) //獲取公網(wǎng)IP
ipList = socket.gethostbyname_ex(hostname) //獲取IP列表(內(nèi)網(wǎng)+外網(wǎng)IP)
for i in ipList[2]: #獲取內(nèi)外IP
if(i[:3]=="172" or i[:3]=="192" or i[:3]=="10."):
self.IP=i
圖片.png