Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41988
| Path | csiph.com!usenet.pasdenom.info!aioe.org!newsfeed.x-privat.org!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.013 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:string': 0.09; 'width': 0.09; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'bit': 0.19; 'solution.': 0.20; '>>>': 0.22; 'header:User- Agent:1': 0.23; 'instead.': 0.24; 'string,': 0.24; 'subject:/': 0.26; 'header:X-Complaints-To:1': 0.27; 'fixed': 0.29; "skip:' 10": 0.31; 'really,': 0.31; 'but': 0.35; 'there': 0.35; 'work?': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'worth': 0.66; 'frank': 0.68; "'true'": 0.84; 'subject:True': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Frank Millman <frank@chagford.com> |
| Subject | True/False formats as 1/0 in a fixed width string |
| Date | Wed, 27 Mar 2013 10:40:19 +0200 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | 197.87.50.233 |
| User-Agent | Mozilla/5.0 (Windows NT 5.2; rv:14.0) Gecko/20120713 Thunderbird/14.0 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3797.1364373633.2939.python-list@python.org> (permalink) |
| Lines | 16 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1364373633 news.xs4all.nl 6941 [2001:888:2000:d::a6]:50756 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:41988 |
Show key headers only | View raw
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