- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
#!/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]:
continue
lst_new.append(item)
print lst
print lst_new
Комментарии (0) RSS
Добавить комментарий