jqkyp 发表于 2017-5-4 10:50:43

Python获取host的IP地址

  想获取google.com或者iteye.com的ip地址可以如下

import socket
ip = socket.gethostbyname_ex('wangcheng.iteye.com')
print ip
   开始是想用Google App Engine来获取某个site的主机IP地址,但发现GAE文档中声明


[*]marshal is empty. An import will succeed, but using it will not.
[*]These modules are similarly empty: imp, ftplib, select, socket
  就是说socket可以import,但无法使用,而fetch
也不提供获取主机IP的能力,暂时作罢,等GAE-Java出来再看看
页: [1]
查看完整版本: Python获取host的IP地址