SyntaxFix
Write A Post
Hire A Developer
Questions
If you prefer a one-liner:
matched_lines = [line for line in my_string.split('\n') if "substring" in line]