for line in list: if substring in line: (do your thing here)