Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #4842
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Peter Otten <__peter__@web.de> |
| Newsgroups | de.comp.lang.python |
| Subject | Re: [Python-de] { als Zeichen in Format |
| Date | Mon, 03 Jul 2017 14:04:56 +0200 |
| Organization | None |
| Lines | 24 |
| Message-ID | <mailman.27.1499083512.2926.python-de@python.org> (permalink) |
| References | <eruls4Fp2pU1@mid.individual.net> <b90b0520-9c06-5658-de70-8d603a437529@sschwarzer.net> <ojdbt2$mn9$2@blaine.gmane.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | 8Bit |
| X-Trace | news.uni-berlin.de EaTKWLFMGwd0ez1Sbk7aEQIhCdS1bMBkA/RspZdtiplA== |
| Return-Path | <gcpgg-python-de@m.gmane.org> |
| X-Original-To | python-de@python.org |
| Delivered-To | python-de@mail.python.org |
| X-Injected-Via-Gmane | http://gmane.org/ |
| User-Agent | KNode/4.13.3 |
| X-BeenThere | python-de@python.org |
| X-Mailman-Version | 2.1.24 |
| Precedence | list |
| List-Id | Die Deutsche Python Mailingliste <python-de.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-de>, <mailto:python-de-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-de/> |
| List-Post | <mailto:python-de@python.org> |
| List-Help | <mailto:python-de-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-de>, <mailto:python-de-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <ojdbt2$mn9$2@blaine.gmane.org> |
| X-Mailman-Original-References | <eruls4Fp2pU1@mid.individual.net> <b90b0520-9c06-5658-de70-8d603a437529@sschwarzer.net> |
| Xref | csiph.com de.comp.lang.python:4842 |
Show key headers only | View raw
Stefan Schwarzer wrote:
> On 2017-07-03 12:50, Hermann Riemann wrote:
>> computed_len=zahl=4 # Testzeile für Beispiel
>> s="{:%d}"%computed_len
>> print(s.format(zahl)) # Testzeile für Beispiel
>>
>> Wie setze ich die Zeile mit s= nach format um?
>
> Meinst du sowas:
>
>>>> "{{:{}d}}".format(5)
> '{:5d}'
>
> Ich habe das jetzt auf die Schnelle aber auch nicht in der Doku gefunden,
> sondern hatte eine vage Erinnerung, dass ich da mal was gelesen hatte.
https://docs.python.org/dev/library/string.html#format-string-syntax
"""
If you need to include a brace character in the literal text, it can be
escaped by doubling: {{ and }}.
"""
Back to de.comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
{ als Zeichen in Format Hermann Riemann <nospam.ng@hermann-riemann.de> - 2017-07-03 12:50 +0200
Re: [Python-de] { als Zeichen in Format Stefan Schwarzer <sschwarzer@sschwarzer.net> - 2017-07-03 13:21 +0200
Re: [Python-de] { als Zeichen in Format Hermann Riemann <nospam.ng@hermann-riemann.de> - 2017-07-03 15:07 +0200
Re: [Python-de] { als Zeichen in Format Peter Otten <__peter__@web.de> - 2017-07-03 13:59 +0200
Re: [Python-de] { als Zeichen in Format Peter Otten <__peter__@web.de> - 2017-07-03 14:04 +0200
Re: [Python-de] { als Zeichen in Format Hermann Riemann <nospam.ng@hermann-riemann.de> - 2017-07-03 15:34 +0200
csiph-web