I want to concatenate one item with the previous one if the item doesnt start with a digit
For example:
l = ["1. first paragraph", "2. second paragraph", "end of second paragraph", "3. third paragraph"]
result = []
curr_str = ""
for item in l:
curr_str += item
if not item[0].isdigit():
result.append(curr_str)
curr_str = ""
What I want
result = ["1. first paragraph", "2. second paragraphend of second paragraph", "3. third paragraph"]
What I have
result=["1. first paragraph2. second paragraphend of second paragraph"]