find digits in string A quick way to get the change stats from this commit message line: >>> s = "2 files changed, 31 insertions(+), 3 deletions(-)" >>> import re >>> re.findall("\d+", s) ['2', '31', '3'] #regex