If your line has multiple ##()##
, what would be your output? ie, if there is overlapping of the patterns and you want to get those overlaps
>>> line="blah ## i want 1 ## blah blah ## i want 2 ## blah"
>>> line.split("##")[1:-1]
[' i want 1 ', ' blah blah ', ' i want 2 ']
>>> line="blah ## i want 1 ## blah"
>>> line.split("##")[1:-1]
[' i want 1 ']
>>> line="blah ## i want 1 ## blah ## "
>>> line.split("##")[1:-1]
[' i want 1 ', ' blah ']
>>>
If you don't want overlapping,
>>> line="blah ## i want 1 ## blah ## i want ## "
>>> [i for n,i in enumerate(line.split("##")[1:]) if n%2==0]
[' i want 1 ', ' i want ']
>>> line="blah ## i want 1 ## blah "
>>> [i for n,i in enumerate(line.split("##")[1:]) if n%2==0]
[' i want 1 ']
>>> line="blah ## i want 1 ## blah ## iwant2 ## junk ## i want 3 ## ..."
>>> [i for n,i in enumerate(line.split("##")[1:]) if n%2==0]
[' i want 1 ', ' iwant2 ', ' i want 3 ']
>>>