3 Jul
2017
3 Jul
'17
6:07 a.m.
Am 03.07.2017 um 13:21 schrieb Stefan Schwarzer:
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.
Danke, die Verdoppelung war das gesuchte. Hermann der es auch nicht in seiner Doku (Python 3 Bücher) gefunden hat. -- http://www.hermann-riemann.de