summaryrefslogtreecommitdiffhomepage
path: root/python3.html.markdown
diff options
context:
space:
mode:
authorAdam Brenecki <adam@brenecki.id.au>2014-07-15 13:30:27 +0930
committerAdam Brenecki <adam@brenecki.id.au>2014-07-15 13:30:27 +0930
commit0654a19b44b290828211372e8148338c4c1d1c23 (patch)
treeac0d0de595601f5ad589dfad4a94336519894356 /python3.html.markdown
parent06087523c5855e18a281b3d06ce708262844801c (diff)
[python3/en] Clean up confusion between % and .format()
Diffstat (limited to 'python3.html.markdown')
-rw-r--r--python3.html.markdown4
1 files changed, 2 insertions, 2 deletions
diff --git a/python3.html.markdown b/python3.html.markdown
index 7657295d..43d62e77 100644
--- a/python3.html.markdown
+++ b/python3.html.markdown
@@ -292,7 +292,7 @@ prints:
mouse is a mammal
"""
for animal in ["dog", "cat", "mouse"]:
- # You can use % to interpolate formatted strings
+ # You can use format() to interpolate formatted strings
print("{} is a mammal".format(animal))
"""
@@ -471,7 +471,7 @@ class Human(object):
# An instance method. All methods take "self" as the first argument
def say(self, msg):
- return "{name}: {message}" % (name=self.name, message=msg)
+ return "{name}: {message}".format(name=self.name, message=msg)
# A class method is shared among all instances
# They are called with the calling class as the first argument