Skip to content

Instantly share code, notes, and snippets.

@nomeyer
Forked from matthieualouis/get_all_positions.py
Last active February 10, 2016 20:54
Show Gist options
  • Save nomeyer/8b0c7b68e37a6110113a to your computer and use it in GitHub Desktop.
Save nomeyer/8b0c7b68e37a6110113a to your computer and use it in GitHub Desktop.
Get all positions of a value in a list
L = [1, 2, 3, 1]
[i for i, x in enumerate(L) if x == value]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment