[Python] Récupérer l'adresse IP du LAN
def getLocalIP():
''' Renvoie l'adresse IP local (LAN). '''
try:
return socket.gethostbyname_ex('')[2][0]
except socket.herror:
pass
try:
return socket.gethostbyname(socket.gethostname())
except:
pass
raise socket.error, "Unable to determine LAN IP address."
2012-12-13 22:40:12
?4I13sg