IP address
Scripter47
nospam at riddergarn.dk
Mon Jan 29 07:12:58 EST 2007
Beej skrev:
> On Jan 28, 2:26 am, Klaus Alexander Seistrup <k... at seistrup.dk> wrote:
>> Scripter47 wrote:
>>> How do i get my ip address?
>>> in cmd.exe i just type "ipconfig" then it prints:
>>> ...
>>> IP-address . . . . . . . . . . . . . . . . . : 192.168.1.10
>>> ...
>>> how can i do that in python??#v+
>> python -c 'import re, urllib; print re.findall("<title>Your IP: (.+?)</title>", urllib.urlopen("http://myip.dk/").read())[0]'
>
> This is extremely unlikely to return 192.168.1.10. :-)
>
> (It will give you the address of your firewall or whatever is your
> gateway to the outside world... which is a cool thing to know, but
> I'm not sure it's what the op's after.)
>
> -Beej
>
Exactly i wnat my local ip. sorry if i din't tell that ;)
More information about the Python-list
mailing list