IP address

Klaus Alexander Seistrup klaus at seistrup.dk
Sun Jan 28 06:37:39 EST 2007


Scripter47 wrote:

>> python -c 'import re, urllib; print re.findall("<title>Your IP: (.+?)</title>", urllib.urlopen("http://myip.dk/").read())[0]'
> 
> Hmm then you need Internet connecting.

That's what IP adresses are for...

> can i do it without that?

Perhaps you could use the method mentioned in
  http://mail.python.org/pipermail/python-list/1999-August/009153.html

> and it doesn't work either :(

Works for me:

#v+

klaus at home:~ $ python -c 'import re, urllib; print re.findall("<title>Your IP: (.+?)</title>", urllib.urlopen("http://myip.dk/").read())[0]'
217.157.1.202
klaus at home:~ $

#v-

Cheers,

-- 
Klaus Alexander Seistrup
http://klaus.seistrup.dk/




More information about the Python-list mailing list