IP address to binary conversion
aleaxit at yahoo.com
Fri Jun 15 06:15:54 EDT 2001
"Jeroen Wolff" <jwolff at ision.nl> wrote in message
news:vqajitkao6tvll7ads8v84nbatp1hhr8jn at 4ax.com...
> >>>> host = n & mask
> >>>> net = n - host
> >>>> print "net: %X host: %X" % (net, host)
> >net: C0000000 host: A80201
> Is there a way back to present the calculated results in a doted
> decimal notation?
>>> import socket, struct
>>> print socket.inet_ntoa(struct.pack("!L",host))
More information about the Python-list