您的位置:首页 > 编程语言 > Python开发

python2.7_1.3_获取远程设备的IP地址

2016-01-28 16:54 579 查看
代码如下:

# -*- coding: utf-8 -*-
import socket

def get_remote_machine_info():
remote_host = 'www.python.org'
try:
print 'IP address:%s' % socket.gethostbyname(remote_host)
except socket.error, err_msg:
print '%s:%s' % (remote_host, err_msg)

if __name__ == '__main__':
get_remote_machine_info()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: