def dottedQuadToNum(ip):
 import socket, struct
 try:
  return struct.unpack('!L', socket.inet_aton(ip.strip()))[0]
 except socket.error:
  if (ip.strip() == '255.255.255.255'):
   return 4294967295L
  else:
   raise ValueError(('Not a good dotted-quad IP: %s' % ip))
 return

def dottedQuadToNum ( ip ) : import socket , struct try : return struct . unpack ( '!L' , socket . inet_aton ( ip . strip ( ) ) ) [ 0 ] except socket . error : if ( ip . strip ( ) == '255.255.255.255' ) : return 4294967295 L else : raise ValueError ( ( 'Not a good dotted-quad IP: %s' % ip ) ) return
convert decimal dotted quad string to long integer .