Re: finding IP address of computer

2006-04-30 Thread Paul Watson
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

Re: finding IP address of computer

2006-04-28 Thread DarkBlue
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()

Re: finding IP address of computer

2006-04-27 Thread Terry Reedy
"Grant Edwards" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 2006-04-27, Gregor Horvath <[EMAIL PROTECTED]> wrote: >> Chris schrieb: >>> How do I find and print to screen the IP address of the computer my >>> python program is working on? >>> >> >> IP adresses are bound to net

Re: finding IP address of computer

2006-04-27 Thread Grant Edwards
On 2006-04-27, Gregor Horvath <[EMAIL PROTECTED]> wrote: > Chris schrieb: >> How do I find and print to screen the IP address of the computer my >> python program is working on? >> > > IP adresses are bound to network interfaces not to computers. > One Computer can have multiple network interfaces

Re: finding IP address of computer

2006-04-27 Thread sturlamolden
print '127.0.0.1' :-P -- http://mail.python.org/mailman/listinfo/python-list

Re: finding IP address of computer

2006-04-27 Thread Jorge Godoy
Chris wrote: > hehe, works a charm, cheers mate. Beware that if you have a different entry in your hosts file you can match a different name. Test it: - add "127.0.0.2yourhost.yourdomain yourhost" to /etc/hosts - rerun the code. You'll see "127.0.0.2" as the result. So take that into acco

Re: finding IP address of computer

2006-04-27 Thread Chris
hehe, works a charm, cheers mate. -- http://mail.python.org/mailman/listinfo/python-list

Re: finding IP address of computer

2006-04-27 Thread BartlebyScrivener
One way: >>> import socket >>> socket.getaddrinfo(socket.gethostname(), None)[0][4][0] It was the first google hit -- http://mail.python.org/mailman/listinfo/python-list

Re: finding IP address of computer

2006-04-27 Thread Gregor Horvath
Chris schrieb: > How do I find and print to screen the IP address of the computer my > python program is working on? > IP adresses are bound to network interfaces not to computers. One Computer can have multiple network interfaces. -- Servus, Gregor http://www.gregor-horvath.com -- http://

finding IP address of computer

2006-04-27 Thread Chris
How do I find and print to screen the IP address of the computer my python program is working on? -- http://mail.python.org/mailman/listinfo/python-list