It might depend on what OS you are using, but here is one way ...
[php]# socket.getaddrinfo returns a list of tuples
# tuple[4][0] of each list element is the IP address
import socket
addrs = socket.getaddrinfo(socket.gethostname(), None)
for addr in addrs:
print addr[4][0]
[/php]
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
Offline 5,792 posts
since Oct 2004