Message377208
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 |
|
| Date |
User |
Action |
Args |
| 2020-09-20 06:46:37 | anudeepballa07 | set | recipients:
+ anudeepballa07 |
| 2020-09-20 06:46:37 | anudeepballa07 | set | messageid: <1600584397.02.0.984052429754.issue41820@roundup.psfhosted.org> |
| 2020-09-20 06:46:36 | anudeepballa07 | link | issue41820 messages |
| 2020-09-20 06:46:36 | anudeepballa07 | create | |
|