Python Tested
Group items by a key
Collect a list of records into a dictionary of lists keyed by a field or function result.
Loading snippets…
3 snippets
Collect a list of records into a dictionary of lists keyed by a field or function result.
Flatten arbitrarily nested lists and tuples into a single flat iterator, leaving strings intact.
Deduplicate a list while preserving the first occurrence order, for hashable values or by key.