Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
21 lines (14 loc) · 365 Bytes

File metadata and controls

21 lines (14 loc) · 365 Bytes
Copy raw file
Download raw file
Edit and raw actions
@author jackzhenguo
@desc 
@date 2019/11/30

127 找出所有重复元素

from collections import Counter


def find_all_duplicates(lst):
    c = Counter(lst)
    return list(filter(lambda k: c[k] > 1, c))


find_all_duplicates([1, 2, 2, 3, 3, 3])  # [2,3]
[上一个例子](126.md) [下一个例子](128.md)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.