THE WORLD'S LARGEST WEB DEVELOPER SITE

Python bin() Function

❮ Built-in Functions


Example

Return the binary version of 36:

x = bin(36)
Run example »

Definition and Usage

The bin() function returns the binary version of a specified integer.

The result will always start with the prefix 0b.


Syntax

bin(n)

Parameter Values

Parameter Description
n Required. An integer

❮ Built-in Functions