THE WORLD'S LARGEST WEB DEVELOPER SITE

Python bool() Function

❮ Built-in Functions


Example

Return the boolean value of 1:

x = bool(1)
Run example »

Definition and Usage

The bool() function returns the boolean value of a specified object.

The object will always return True, unless:

The object is empty, like [], (), {}
The object is False
The object is 0
The object is None


Syntax

bool(object)

Parameter Values

Parameter Description
object Any object, like String, List, Number etc.

❮ Built-in Functions