- 帖子
- 10
- 精华
- 0
- 积分
- 49
- 阅读权限
- 10
- 注册时间
- 2018-4-5
- 最后登录
- 2018-5-7
|
#keng2
def del_repeat(list):
result = []
lenc = len(list)-1
n = 0
for i in range(n,lenc):
i = n
if list in list[i+1:]:
# print list
list.pop(i)
lenc-=1
if i >0:
n =i
if i ==0:
n =0
else:
# print "result:%d" % list
result.append(list)
print result
n = i+1
result.append(list[-1])
return result
a = [1,2,3,4,3,5,6,4,1,2,7,7,7,4]
b = [1,2,3,4]
x = del_repeat(a)
print x
y = del_repeat(b)
print y
|
|