获得远程ip

import socket
remote_host='www.baidu.com'
try:
    print"IP address: %s" %socket.gethostbyname(remote_host)
except socket.error,err_msg:
    print"%s %s:" %(remote_host , err_msg)

 

posted @ 2018-08-24 11:02  菜鸟的蜕变  阅读(157)  评论(0)    收藏  举报