[issue24112] %b does not work, as a binary output formatter

Steven D'Aprano report at bugs.python.org
Sat May 2 12:57:22 CEST 2015


Steven D'Aprano added the comment:

This is not a bug, since %b is not supported in Python 2, only in Python 3:

https://docs.python.org/2/library/stdtypes.html#string-formatting-operations

No new features will be added to 2.7, so if you need %b you can use Python 3, or in Python 2.7 you can use the newer string format method instead:

py> "{:b}".format(42)
'101010'

----------
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24112>
_______________________________________


More information about the Python-bugs-list mailing list