def ip_p(ip_string): try: bytes = map(int, ip_string.split('.')) except ValueError: return None return 0 <= min(bytes) <= max(bytes) < 256 HTH. Alex.