Thread: IP adresses
View Single Post
Join Date: Oct 2004
Posts: 3,862
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 870
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: IP adresses

 
0
  #2
Nov 6th, 2005
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]
May 'the Google' be with you!
Reply With Quote