Python to tell what is the IP of my PC

空心菜 zhaoqz at gmail.com
Thu Nov 9 08:52:46 CET 2006


>>> import re,urllib2
>>> re.search('\d+\.\d+\.\d+\.\d+',urllib2.urlopen("http://www.hereismyip.com").read()).group()
'xx.xx.xxx.xxx′


On 11月9日, 上午11时06分, Hieu Hoang <dhh... at student.monash.edu>
wrote:
> Hi list,
> I think a script to extract the IP from some websites like
> whatismyip.com could do the job. I don't know how to write it though,
> sure someone can give
> direction on that.
> 
> Cheers,
> Rooy




More information about the Python-list mailing list