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
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()
"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
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
print '127.0.0.1'
:-P
--
http://mail.python.org/mailman/listinfo/python-list
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
hehe, works a charm, cheers mate.
--
http://mail.python.org/mailman/listinfo/python-list
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
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://
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
10 matches
Mail list logo