Python bool() Function

❮ Built-in Functions


Example

Return the boolean value of 1:

x = bool(1)
Try it Yourself »

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

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.