import re ... my_list = [] for line in f: my_list += re.findall('snRate (\d.?\d+)', line)