ip address?

Unintelligent Troll ut at example.com
Sun Feb 10 15:28:06 EST 2002


As written, this returns '127.0.0.1' on most non-windows platforms. This
is not likely to be the result the original poster wants.

In article <mailman.1012006124.8671.python-list at python.org>, "Tim Peters"
<tim.one at home.com> wrote:

> [maximilianscherr]
>> how can i get the internet ip address of my connected pc?
> 
> Give this a try; your money back if it blows up <wink>:
> 
> import socket
> myip = socket.gethostbyname(socket.gethostname())
> 
>



More information about the Python-list mailing list