grizzley grizzley - 6 months ago 17
Python Question

Removing all non-numeric characters from string in Python

How do we remove all non-numeric characters from a string in Python?

Answer
>>> import re
>>> re.sub("[^0-9]", "", "sdkjh987978asd098as0980a98sd")
'987978098098098'