Start of main content## Python Snippets

The Python snippet collection contains helper functions for Python 3.6. It includes utilities for most common data types, such as primitivies, lists, dictionaries and date objects.

### Filter unique list values

Python, List

Creates a list with the unique values filtered out.

### Group list elements

Python, List

Groups the elements of a list based on the given function.

### Shuffle list

Python, List

Randomizes the order of the values of an list, returning a new list.

### Sort dictionary by value

Python, Dictionary

Sorts the given dictionary by value.

### Map list to dictionary

Python, List

Maps the values of a list to a dictionary using a function.

Learn how Python's lists and tuples are different and level up your code today.

### List difference based on function

Python, List

Returns the difference between two lists, after applying the provided function to each list element of both.

### Get nested value

Python, Dictionary

Retrieves the value of the nested key indicated by the given selector list from a dictionary or list.

### List intersection based on function

Python, List

Returns a list of elements that exist in both lists, after applying the provided function to each list element of both.

### List symmetric difference based on function

Python, List

Returns the symmetric difference between two lists, after applying the provided function to each list element of both.

### List union based on function

Python, List

Returns every element that exists in any of the two lists once, after applying the provided function to each element of both.

### Digitize number

Python, Math

Converts a number to a list of digits.

### Find matching index

Python, List

Finds the index of the first element in the given list that satisfies the provided testing function.

### Find all matching indexes

Python, List

Finds the indexes of all elements in the given list that satisfy the provided testing function.

### Find last matching index

Python, List

Finds the index of the last element in the given list that satisfies the provided testing function.