File “/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/ipaddress.py”, line 1454, in init
raise ValueError(‘%s has host bits set’ % self)
ValueError: 192.168.1.1/24 has host bits set
This returns an error. If I change the IP address to 192.168.1.0/24 then it’ll return 192.168.1.0/24. Isn’t this function supposed to return 192.168.1.0/24 when I give it 192.168.1.1/24?
classipaddress.IPv4Network ( address , strict=True )
[…]
If strict is True and host bits are set in the supplied address, then ValueError is raised. Otherwise, the host bits are masked out to determine the appropriate network address.