Skip to content

Instantly share code, notes, and snippets.

@piyonishi
Created July 22, 2013 10:43
Show Gist options
  • Save piyonishi/6052966 to your computer and use it in GitHub Desktop.
Save piyonishi/6052966 to your computer and use it in GitHub Desktop.
l = [1, 1, 2, 2, 3]
distinct_result = list()
map(lambda x: not x in distinct_result and distinct_result.append(x), l)
print(distinct_result)
#[1, 2, 3]
distinct_result = list(set(l))
print(distinct_result)
#[1, 2, 3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment