- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
#!/usr/bin/python
lst = [1,2,2,3,4,4,5,6,5,6]
lst_new = []
for idx, item in enumerate(lst):
if idx == len(lst) - 1:
continue
if lst[idx] != lst[idx + 1]:
lst_new.append(item)
print lst
print lst_new
Комментарии (0) RSS