print difflist
for line in difflist:
if ((line.startswith('<'))or (line.startswith('>')) or (line.startswith('---'))):
difflist.remove(line)
print difflist
Here, initially,
difflist = ['1a2', '> ', '3c4,5', '< staring', '---', '> starring', '> ', '5c7', '< at ', '---', '> add ', '']
And what i expect of the code is to print
['1a2', '3c4,5', '5c7', '']
But what i get instead is
difflist= ['1a2', '3c4,5', '---', '> ', '5c7', '---', '']