Programming-Idioms

History of Idiom 76 > diff from v30 to v31

Edit summary for version 31 :

Version 30

2015-10-31, 14:27:13

Version 31

2015-10-31, 14:31:43

Idiom #76 Binary digits from an integer

Create the string s of integer x written in base 2.

E.g. 13 -> "1101"

Idiom #76 Binary digits from an integer

Create the string s of integer x written in base 2.

E.g. 13 -> "1101"

Code
x = 0xFF
s = '{:b}'.format(x)
Code
s = '{:b}'.format(x)
Doc URL
https://docs.python.org/3/library/string.html#formatstrings
Doc URL
https://docs.python.org/3/library/string.html#formatstrings
Origin
https://docs.python.org/3/library/string.html#formatstrings
Origin
https://docs.python.org/3/library/string.html#formatstrings