Learn and Learn

Learn And Learn - great place for tutorials, references and how-to

Python bin() function

bin() is a built-in function in python programming language which converts an integer number to binary string.
bin() function is a part of Python Built-in Functions (check list)

bin() Syntax

 

bin(n) Parameters

n – where n is an integer.

 

bin() Return Value

bin() function returns a binary string of an integer or int object.

 

bin() Compatibility

This function is available and compatible with both Python 2.x and 3.x

 

bin() Function Example 1

When integer number to convert into binary string bin()

Return value: 0b10
0b10 is binary string.

 

bin() Function Example 2


Output: 0b111110100

LearnAndLearn.com © 2018 - All rights reserved