Anudeep Balla added the comment:
Greetings,
Any Ip address containing 2 zeros or more are considered to be an invalid
IP address.
'172.16.254.00' *is not* equivalent to '172.16.254.0'
I guess this small logic is causing the error
I hope it makes it clear from the below images.
Regards,
Raj
Eric V. Smith added the comment:
Given that RFC 790 uses 000 as an octet (thanks Serhiy), I think the bug here,
if there is one, is in the other validator that you're using. Without a
standard saying not to accept 00 or 000, I think we won't make any change here.
--
Anudeep Balla added the comment:
That was the whole point I was trying to make that there were no references
that state .00 is equivalent to .0 and if you would try any IP validator
or would check by any means you would find that the IP address is invalid.
I truly understand the point that yo
Serhiy Storchaka added the comment:
Why do you think it is invalid? What formal document specify this?
In contrary, there are examples of using 0-padded notation for IPv4 addresses
(000.rrr.rrr.rrr, 128.000.rrr.rrr, 192.000.001.rrr and 224.000.000.000) in RFC
790.
--
nosy: +serhiy.s
Eric V. Smith added the comment:
Please do not include screen shots in bug reports. They've unfriendly to people
who use screen readers or other accessibility software. Instead, please copy
and paste (or retype, if needed) the text into the comment section.
> '172.16.254.00' *is not* equival
Eric V. Smith added the comment:
Simplified:
>>> import ipaddress
>>> print(ipaddress.ip_address('172.16.254.00').version)
4
So your concern is that you think '172.16.254.00' (or equivalently,
'172.16.254.0') shouldn't be treated as a valid IPv4 address. Is that correct?
Can you tell us why
New submission from Anudeep Balla :
https://docs.python.org/3.8/library/ipaddress.html
import ipaddress
ADDRESSES = [
'172.16.254.00'
]
for ip in ADDRESSES:
addr = ipaddress.ip_address(ip)
if addr.version==4:
{
print("true")
}
else:
{