IP address validator in Python

Pierre Rouleau prouleau_nospam at impathnetworks.com
Thu Dec 5 08:54:43 EST 2002


Cameron Laird wrote:
> In article <3DEE843F.4070401 at impathnetworks.com>,
> Pierre Rouleau  <prouleau_nospam at impathnetworks.com> wrote:
> 
>>Does anyone know where i could find a python function to validate an IP 
>>address.  Ideally the function would return a string describing the IP 
>>address.  Ideally it would support both IP v4 and v6 but i could live 
>>with v4 support only for a while.
> 
> 			.
> 			.
> 			.
> What does it mean to you to be a valid IP address?

You're right, I should have qualified my question.

What i want is a function that could check if a given address (as 
entered via, let's say, a dotted-decimal string, or hexadecimal value) 
and check if it a valid unique host address, or a valid "this" network 
address, or a valid multicast address, etc...

It could also transform the IP address into a string describing the 
category(ies) the address fits in.

The IPy module mentionned by Klaus Seistrup in this thread is a good 
start.






More information about the Python-list mailing list