def ip_quad_to_numstr(quad):
 bytes = map(int, quad.split('.'))
 packed = struct.pack('BBBB', *bytes)
 return str(struct.unpack('>L', packed)[0])

def ip_quad_to_numstr ( quad ) : bytes = map ( int , quad . split ( '.' ) ) packed = struct . pack ( 'BBBB' , * bytes ) return str ( struct . unpack ( '>L' , packed ) [ 0 ] )
convert an ip address string to an ip number as a base-10 integer given in ascii representation .