On Jun 15, 9:33 am, Olivier LEMAIRE <m.olivier.lema...@gmail.com>
wrote:
> You're right, I use Python 2.6.6

This works great in 2.6.5 and later (and probably earlier). You just
have to number your placeholders. The first set of braces formats i
(your value), the second set specifies the field with (i.e., 8):

>>> for i in xrange(10):
...     print "{0:0{1}b}".format(i,8)
...
00000000
00000001
00000010
00000011
00000100
00000101
00000110
00000111
00001000
00001001
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to