New submission from Anudeep Balla <anudeepball...@gmail.com>:

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:
        {
            print("false")
        }
Screen Shot 2020-09-20 at 1 33 30 AM

I tried to validate an invalid IPv4 address using IPaddress library from py 
3.8.6 but somehow it considers any address ending with "00" to be valid.

I hope this is helpful to the community please let me know if the issue is with 
validation from your end or a bug in the library.

@AnudeepBalla

----------
components: Library (Lib)
messages: 377208
nosy: anudeepballa07
priority: normal
severity: normal
status: open
title: ipaddress Library gives me incorrect results
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41820>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to