bool() / True-False
The truth value (True/False).
Syntax
bool(value)
Description
bool() converts a value to its logical truth. 0, empty text and an empty list are False; everything else is True. Used automatically in conditions.
Returns
True or False.
Example
Loading editor…
Expected output
False True False
When to use?
'Is it empty or full?' check: if items: ... (runs if items is not empty).