Python获取本机Ip地址

import socket
myname = socket.getfqdn(socket.gethostname())
myaddr = socket.gethostbyname(myname)
print myaddr

你可能感兴趣的:(Python获取本机Ip地址)