PEP 3101 – Advanced String Formatting

Abstract

This PEP proposes a new system for built-in string formatting operations, intended as a replacement for the existing '%' string formatting operator.

Samples

a = 'Python'
b = 'Emacs'
d = 'Babel'
print("The story of {0}, {1}, and {c}".format(a, b, c=d))
# or
print(format(10.0, "7.3g"))
The story of Python, Emacs, and Babel
     10


blog comments powered by Disqus

Published

17 January 2017

Categories

literate programming emacs Python3

Tags