I want to merge element in the list based on given start and stop index of tuple (non-overlap for tuple). I\'ll leave the indices that don\'t mention as it is. This is my ex
ls = ['1', '2', '3', '4', '5', '6', '7']
merge = [(1, 3), (5, 7)]
result = []
index = 0
for start, end in merge:
result += ls[index:start]
result.append("".join(ls[start:end]))
index = end
print result # ['1', '23', '4', '5', '67']