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


Topic: Write a Python function to remove leading zeros from an IP address

Solution

import re
regex = '\.[0]*'
def remove_leading_zeros(ip):
    modified_ip = re.sub(regex, '.', ip)
    return modified_ip



List all Python Programs