I have some list like this:
lines = [
"line",
"subline2",
"subline4",
"line",
]
And I want to take list of index of lines which starts with some substring.
I use this approach:
starts = [n for n, l in enumerate(lines) if l.startswith('sub')]
but maybe anybody knows more beautiful approach?