Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41988
| From | Frank Millman <frank@chagford.com> |
|---|---|
| Subject | True/False formats as 1/0 in a fixed width string |
| Date | 2013-03-27 10:40 +0200 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3797.1364373633.2939.python-list@python.org> (permalink) |
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 there any way to make this work?
Frank Millman
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
True/False formats as 1/0 in a fixed width string Frank Millman <frank@chagford.com> - 2013-03-27 10:40 +0200
csiph-web