finding IP address of computer

DarkBlue nomail at nixmail.com
Fri Apr 28 08:58:01 EDT 2006


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()



More information about the Python-list mailing list