2012/3/14 Val <donchisciott...@yahoo.it>

> 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
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python

Rispondere a