programming-examples/python/Regular_Expression/Remove leading zeros from an IP address.py

4 lines
91 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
import re
ip = "216.08.094.196"
string = re.sub('\.[0]*', '.', ip)
print(string)