[Python-Dev] str with base

Barry Warsaw barry at python.org
Tue Jan 17 07:03:32 CET 2006


On Mon, 2006-01-16 at 20:49 -0800, Bob Ippolito wrote:

> The only bases I've ever really had a good use for are 2, 8, 10, and  
> 16.  There are currently formatting codes for 8 (o), 10 (d, u), and  
> 16 (x, X).  Why not just add a string format code for unsigned  
> binary?  The obvious choice is probably "b".
> 
> For example:
> 
>  >>> '%08b' % (12)
> '00001100'
>  >>> '%b' % (12)
> '1100'

+1

-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20060117/14da01fc/attachment.pgp 


More information about the Python-Dev mailing list