I have a function to pick out lumps from a list of strings and return them as another list:
def filterPick(lines,regex): result = [] for l in lines:
It could be shortened a little
def filterPick(lines, regex): matches = map(re.compile(regex).match, lines) return [m.group(1) for m in matches if m]
You could put it all in one line, but that would mean you would have to match every line twice which would be a bit less efficient.