python 获得本机MAC地址:
import uuid
def get_mac_address():
mac=uuid.UUID(int=uuid.getnode()).hex[-12:]
return ":".join([mac[e:e+2] for e in range(0,11,2)])
python获取IP的方法:使用socket
import socketmyname=socket.getfqdn(socket.gethostname( ))
myaddr=socket.gethostbyname(myname)
print(myname)
print(myaddr)