programming-examples/python/Regular_Expression/Remove leading zeros from an IP address.py
2019-11-15 12:59:38 +01:00

4 lines
91 B
Python

import re
ip = "216.08.094.196"
string = re.sub('\.[0]*', '.', ip)
print(string)