Python bin() Function

Python 内置函数Python Built-in Functions


Description

bin()Return the binary representation of an integer int or a long integer long int.

Syntax

The following is the syntax of the bin() method:

bin(x)

Parameters

  • x -- int or long int number

Return Value

String.


Examples

The following shows an example of using the bin function:

>>>bin(10) '0b1010' >>> bin(20) '0b10100'

Python 内置函数Python Built-in Functions

Other Extensions