finding IP address of computer

Paul Watson pwatson at redlinepy.com
Sun Apr 30 22:12:00 EDT 2006


DarkBlue wrote:
> Chris wrote:
> 
> 
>>How do I find and print to screen the IP address of the computer my
>>python program is working on?
> 
> 
> def readip():
>  import re, urllib
>  f = urllib.urlopen('http://checkip.dyndns.org')
>  s = f.read()
>  m = re.search('([\d]*\.[\d]*\.[\d]*\.[\d]*)', s)
>  return m.group(0)
> 
> myip = readip()

IP address and other browser header information available at:

http://xhaus.com/headers



More information about the Python-list mailing list