!/usr/bin/env python3.6import refname = 'a.txt'with open(fname) as f: s = f.read()numbers = [int(i) for i in re.findall(r'\d+', s)]print(f'numbers: {numbers}\nsum: {sum(numbers)}')