[Python-Dev] str with base (original) (raw)

Donovan Baarda abo at minkirri.apana.org.au
Tue Jan 17 09:52:55 CET 2006


On Tue, 2006-01-17 at 01:03 -0500, Barry Warsaw wrote:

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

+1 me too.

-- Donovan Baarda <abo at minkirri.apana.org.au> http://minkirri.apana.org.au/~abo/



More information about the Python-Dev mailing list