IP address

Gabriel Genellina gagsl-py at yahoo.com.ar
Mon Jan 29 02:41:30 CET 2007

At Sunday 28/1/2007 10:28, Colin J. Williams wrote:

>Klaus Alexander Seistrup wrote:
> >
> > python -c 'import re, urllib; print re.findall("<title>Your IP: 
> (.+?)</title>", urllib.urlopen("http://myip.dk/").read())[0]'
> >
>Your one-liner doesn't work for me, with Windows XP, but the following

On XP you should switch the usage of " and ' (double quotes are used 
to enclose command arguments with embedded spaces):

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

Gabriel Genellina
Softlab SRL 


Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 

More information about the Python-list mailing list