Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mggger opened this issue Dec 27, 2017 · 1 comment
Open

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

mggger opened this issue Dec 27, 2017 · 1 comment

Comments

@mggger
Copy link

mggger commented Dec 27, 2017

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]

@coder1688
Copy link

没错,你得print(l2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants