Jul-12-2022, 10:26 PM
(Jul-12-2022, 10:08 PM)Larz60+ Wrote: The /24 indicated the number of bits in the network mask.
I am not sure, but expect that this should be stripped before calling ipaddress methods.
I wouldnt think so, because i have this other function below in the same total code block, that works as expected..
def valid_ip_or_cidr(ip): try: ipaddress.IPv4Address(ip) #print('This is a valid IPs address') return True except: try: ipaddress.IPv4Network(ip) #print('This is a valid network CIDR') return True except: print(ip + ' This is neither a valid IPV4 address or a valid IPV4 CIDR notation, please check your data and try again') #return False sys.exit()