获取主机内网,外网IP,主机名 代码如下: #!/usr/bin/env python #-*- coding:utf-8 -*- # author:Zeng Xianhe import socket import fcntl,struct import time def getHardware(outip,inip): sk = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) ##1.获取主机名 hostname = socket.gethos…