How to get IP address

Gerhard Häring gerhard.haering at
Mon Mar 3 15:04:57 CET 2003

Nagy László Zsolt <nagylzs at> wrote:
> It seems to me that there is no way to get all IP addresses of the machine
> where your Python program is running. The standard library does not provide a
> function to do this. [...]
> Any comments from Python experts? Did I missed something?

Sorry, I haven't read this thread. What I'd try to do is parse the routing
information from the operating system. How to get this information is
platform dependent, on Linux, you can use "route -n", on FreeBSD,
"netstat -rn" and on Windows "route print".

My Windows here says:

Network Destination        Netmask          Gateway       Interface  Metric

-- Gerhard

More information about the Python-list mailing list