获取远程设备IP地址

来源:互联网 发布:高仿球鞋的淘宝店 编辑:程序博客网 时间:2024/05/22 17:41
import socketdef get_remote_machine_info():    remote_host = 'www.python.org'    try:        print "IP adress: %s" %socket.gethostbyname(remote_host)    except socket.error, err_msg:        print "%s: %s" %(remote_host, err_msg)get_remote_machine_info() #IP adress: 103.245.222.223
0 0
原创粉丝点击