Skip to content

Latest commit

 

History

History
39 lines (34 loc) · 953 Bytes

2017-01-17-string-formaitting-in-python3.org

File metadata and controls

39 lines (34 loc) · 953 Bytes

PEP 3101 – Advanced String Formatting

link

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"))