Re: True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Frank Millman
On 27/03/2013 10:55, Dave Angel wrote: On 03/27/2013 04:40 AM, Frank Millman wrote: Hi all This is a bit of trivia, really, as I don't need a solution. But someone might need it one day, so it is worth mentioning. >>> '{}'.format(True) 'True' >>> '{:<10}'.format(True) '1 ' One migh

Re: True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Frank Millman
On 27/03/2013 10:52, Peter Otten wrote: Frank Millman wrote: >>> '{}'.format(True) 'True' >>> '{:<10}'.format(True) '1' One might want to format True/False in a fixed width string, but it returns 1/0 instead. Is there any way to make this work? "{!s:<10}".format(True) 'True' Works

Re: True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Dave Angel
On 03/27/2013 04:40 AM, Frank Millman wrote: Hi all This is a bit of trivia, really, as I don't need a solution. But someone might need it one day, so it is worth mentioning. >>> '{}'.format(True) 'True' >>> '{:<10}'.format(True) '1 ' One might want to format True/False in a fixed w

Re: True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Peter Otten
Frank Millman wrote: > >>> '{}'.format(True) > 'True' > >>> '{:<10}'.format(True) > '1 ' > > One might want to format True/False in a fixed width string, but it > returns 1/0 instead. Is there any way to make this work? >>> "{!s:<10}".format(True) 'True ' -- http://mail.python.

True/False formats as 1/0 in a fixed width string

2013-03-27 Thread Frank Millman
Hi all This is a bit of trivia, really, as I don't need a solution. But someone might need it one day, so it is worth mentioning. >>> '{}'.format(True) 'True' >>> '{:<10}'.format(True) '1 ' One might want to format True/False in a fixed width string, but it returns 1/0 instead. Is the