On Jan 28, 2:26 am, Klaus Alexander Seistrup <[EMAIL PROTECTED]> 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 -- http://mail.python.org/mailman/listinfo/python-list