interview_python icon indicating copy to clipboard operation
interview_python copied to clipboard

去除列表中重复元素,列表推导答案有误

Open mggger opened this issue 8 years ago • 1 comments

l1 = [1, 2, 3, 4, 5, 1, 2] l2 = [] [l2.append(i) for i in l1 if not i in l2] [None, None, None, None, None]

mggger avatar Dec 27 '17 08:12 mggger

没错,你得print(l2)

coder1688 avatar Feb 26 '18 14:02 coder1688