2012/3/14 Val <[email protected]>
> import socket
>
> try:
> host = socket.gethostbyaddr(IP_curr)[0]
> except socket.herror:
> host = 0
>
>
> if host == 0:
> msg = msg + "OFFLINE"
> else:
> msg = msg + str(host)
>
> print msg
>
Non so se funziona, ma come codice io lo scriverei così:
try:
msg += str(socket.gethostbyaddr(IP_curr)[0])
except socket.herror:
msg += "OFFLINE"
Ciao.
Marco.
_______________________________________________
Python mailing list
[email protected]
http://lists.python.it/mailman/listinfo/python