Skip to content
Built-in Functions

bool()

Convert a value to True or False.

bool(value=False)

bool() tests whether a value counts as true. Empty collections, zero, and an empty string are false; many other values are true.

Parameters

NameDescription
valueThe value to test. If omitted, it defaults to false.

Returns

True or False.

Try it

Run it and change it
items = []
print(bool(items))

Related entries