Checks if the a value is an empty sequence or collection.
not
to test the truth value of the provided sequence or collection.def is_empty(val):
return not val
is_empty([]) # True
is_empty({}) # True
is_empty('') # True
is_empty(set()) # True
is_empty(range(0)) # True
is_empty([1, 2]) # False
is_empty({ 'a': 1, 'b': 2 }) # False
is_empty('text') # False
is_empty(set([1, 2])) # False
is_empty(range(2)) # False
Python, List
Maps the values of a list to a dictionary using a function.
Python, List
Converts a list of dictionaries into a list of values corresponding to the specified key
.
Python, List
Combines two lists into a dictionary, using the first one as the keys and the second one as the values.