Revision: 13829
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 7, 2009 10:14 by rdicicco
Initial Code
def IntToDottedIP( intip ): octet = '' for exp in [3,2,1,0]: octet = octet + str(intip / ( 256 ** exp )) + "." intip = intip % ( 256 ** exp ) return(octet.rstrip('.')) def DottedIPToInt( dotted_ip ): exp = 3 intip = 0 for quad in dotted_ip.split('.'): intip = intip + (int(quad) * (256 ** exp)) exp = exp - 1 return(intip)
Initial URL
Initial Description
Convert an IP address to an integer for easier storage. Also, convert an integer back to an IP address.
Initial Title
Convert IP to Int and Int to IP
Initial Tags
Initial Language
Python