any(d)
This will return true if the dict. d contains at least one truelike key, false otherwise.
Example:
any({0:'test'}) == False
another (more general) way is to check the number of items:
len(d)
any(d)
This will return true if the dict. d contains at least one truelike key, false otherwise.
Example:
any({0:'test'}) == False
another (more general) way is to check the number of items:
len(d)