Thank you very much
Sent from my iPhone
> On Apr 3, 2017, at 7:04 PM, Martin A. Brown wrote:
>
>
> Hello there,
>
>> 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
On 03/04/17 19:43, Ed Manning wrote:
> untrust_ip_address = raw_input('\nEnter the untrust IP ''"Example
> 172.20.2.3/28"'':')
> while not ipaddress.ip_network untrust_ip_address:
Doesn't that give a syntax error?
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http
Hello there,
>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"'':')
This is a representation of an IP address along with the mask length for the
prefix:
172.20.2.3/28
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 untrus
On 01/04/17 17:29, Alex Kleider wrote:
> Good point! I hadn't considered IPV6 and didn't know about the ipaddress
> module.
Me too, on both counts. Actually I should have known about
ipaddress because this question has come up before but
I'd forgotten... :-(
And as for forgetting IP6 - as an ex
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 un
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 subscript
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 va
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
Hello there,
>What's the best way to validate a string contains a IP address
If you are only talking about validating that something is an IP
address, then I can even give you a little Python2 / Python3 snippet
that can do that. I like the EAFP [0] approach for this sort of
thing.
There ar
On 01/04/17 00:35, Ed Manning wrote:
>
> What's the best way to validate a string contains a IP address
It depends on how thorough you want to be.
You can define a regex to check that its 4 groups of numbers
separated by periods.
Or you can split the string into fields and validate that
the val
11 matches
Mail list logo