On Fri, Mar 31, 2017 at 07:35:48PM -0400, Ed Manning wrote:
> 
> What's the best way to validate a string contains a IP address 

Don't reinvent the wheel, use the ipaddress module.

py> import ipaddress
py> ipaddress.ip_address('99.99.99.99')
IPv4Address('99.99.99.99')


If the address is not a valid address syntax, it will raise ValueError.


-- 
Steve
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to