How would I use python to convert an IP address that comes as a str to a decimal number and vice versa?
str
For example, for the IP 186.99.109.000 &l
186.99.109.000 &l
Here's one
def ipv4_to_int(ip): octets = ip.split('.') count = 0 for i, octet in enumerate(octets): count += int(octet) << 8*(len(octets)-(i+1)) return count