How to write a Python regular expression to get numbers except decimal?


The following code gets the numbers in the given string except the decimal

>>> m = re.match(r"(\d+)\.(\d+)", "80.3196")
>>> m.groups()
('80', '3196')

Updated on: 19-Feb-2020

137 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements