Hello what am I going wrong here? i need to validate this is an IP or ask the question again
untrust_ip_address = raw_input('\nEnter the untrust IP ''"Example 172.20.2.3/28"'':') while not ipaddress.ip_network untrust_ip_address: untrust_ip_address = raw_input('\nEnter the untrust IP ''"Example 172.20.2.3/28"'':') > On Apr 1, 2017, at 12:29 PM, Alex Kleider <aklei...@sonic.net> wrote: > > On 2017-03-31 18:01, Mats Wichmann wrote: >> On 03/31/2017 06:44 PM, Alex Kleider wrote: >>> On 2017-03-31 16:35, Ed Manning wrote: >>>> What's the best way to validate a string contains a IP address >>>> Sent from my iPad >>>> _______________________________________________ >>>> Tutor maillist - Tutor@python.org >>>> To unsubscribe or change subscription options: >>>> https://mail.python.org/mailman/listinfo/tutor >>> The re module perhaps? > >> This assumes "an IP address" is the four dotted numbers characteristic >> of IPv4. These days that's a bad assumption unless you're absolutely >> sure an IPv6 address can never appear. Can you? > > Good point! I hadn't considered IPV6 and didn't know about the ipaddress > module. > Live and learn. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor