#!/usr/bin/env python3 import re import fileinput result_re = re.compile("T: 0 \(.*\) P:.* I:.* C:.* Min: *(?P\d+) Act: *(?P\d+) Avg: *(?P\d+) Max: *(?P\d+)") for line in fileinput.input(): match = result_re.match(line) if match: print(match.group('max'))