Test if every list element is falsy
Checks if the provided function returns True
for at least one element in the list.
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.
Checks if the provided function returns True
for at least one element in the list.
Pads a string on both sides with the specified character, if it's shorter than the specified length.
Here are two quick and elegant ways to check if a string is empty in Python.
Creates a function that will invoke a predicate function for the specified property on a given dictionary.
Curries a function.
Returns a list with n
elements removed from the right.
Returns a list with n
elements removed from the left.
Returns every nth
element in a list.
Returns the index of the element with the minimum value in a list.
Calculates the month difference between two dates.
A very common problem when working with Python is having to remember the correct version. Luckily, there's an easy fix for that.
Returns all elements in a list except for the first one.
Returns a list with n
elements removed from the end.
Returns a list with n
elements removed from the beginning.
Transposes a two-dimensional list.
Checks if all the values in a list are unique.
Calculates the average of two or more numbers.
Calculates the date of n
days ago from today.
Calculates the day difference between two dates.
Calculates the date of n
days from today.
Generates a list, containing the Fibonacci sequence, up until the nth term.
Finds the first key in the provided dictionary that has the given value.
Checks if the given date is a weekday.
Checks if the given date is a weekend.