Merge lists
Merges two or more lists into a list of lists, combining elements from each of the input lists based on their positions.
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.
Merges two or more lists into a list of lists, combining elements from each of the input lists based on their positions.
Learn the difference between Python's built-in list sorting methods and when one is preferred over the other.
Writing efficient Python code can be tricky. Read how we optimize our list snippets to increase performance using a couple of simple tricks.
There's a good way to test the emptiness of a Python list and a better one. Which one are you using?
Sorts one list based on another list containing the desired indexes.
Python's f-strings can do a lot more than you might expect. Learn a few useful tips and tricks in this quick guide.
Inverts a dictionary with non-unique hashable values.
Groups the elements of a list based on the given function and returns the count of elements in each group.
Creates a list of dates between start
(inclusive) and end
(not inclusive).
Combines two or more dictionaries, creating a list of values for each key.
Creates a list with the non-unique values filtered out.
Creates a list with the unique values filtered out.
Groups the elements of a list based on the given function.
Converts a hexadecimal color code to a tuple of integers corresponding to its RGB components.
Builds a list, using an iterator function and an initial seed value.
Converts a given string into a list of words.
Splits values into two groups, based on the result of the given filtering function.
Randomizes the order of the values of an list, returning a new list.
Sorts the given dictionary by value.
Converts a string to camelcase.
Returns the difference between two lists, after applying the provided function to each list element of both.
Retrieves the value of the nested key indicated by the given selector list from a dictionary or list.
Returns a list of elements that exist in both lists, after applying the provided function to each list element of both.
Maps the values of a list to a dictionary using a function.