Hi,

How to remove the coming duplication,

Here I wrote one (not working):


>>> a=['2', '5', '7', '5', '5']
>>> for i in range(len(a)-1):
        if a[i+1]==a[i]:
                a.remove(a[i+1])
        if i not in range(len(a)):
                break

        
>>> a
['2', '7', '5', '5']

I wish to get a is [2,5,7,5]

just remove the coming duplication, not unique the list.

Thanks for any advice,

Best regards,
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to