Q:

Write a Python program to remove leading zeros from an IP address

0

Write a Python program to remove leading zeros from an IP address. 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

def remove_zeros_from_ip(ip_add):
  new_ip_add = ".".join([str(int(i)) for i in ip_add.split(".")])  
  return new_ip_add ;

print(remove_zeros_from_ip("255.024.01.01"))
print(remove_zeros_from_ip("127.0.0.01 "))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now