I want to process a string line by line, but I want to enable multiline support. This is the example text:
First line
Second line
{{{
these three lines
I want to process
together
}}}
Last Line
I want multiline to start at {{{
and finish at }}}
I used to process it line by line in the following way:
lines = [l for l in text.splitlines()]
print lines
Right now this code outputs:
['First line', 'Second line', '{{{', 'these three lines', 'I want to process', 'together', '}}}', 'Last Line']
I want somehow to make lines
contain the following:
['First line', 'Second line', 'these three lines I want to process together', 'Last Line']
Or, more advanced example
First Line
Second line
Third{{{line
fourth line
fifth}}}line
sixth line
In this case I want lines to contain
['First Line', 'Second line', 'Third', 'line fourth line fifth', 'line', 'sixth line']