summaryrefslogtreecommitdiffhomepage
path: root/python3.html.markdown
diff options
context:
space:
mode:
authorAdam Brenecki <adam@brenecki.id.au>2014-07-16 10:25:03 +0930
committerAdam Brenecki <adam@brenecki.id.au>2014-07-16 10:25:03 +0930
commit164cf1ce78bcd96fda2a02addc0217ecdf033b5d (patch)
tree5d8d2656ba5ffdd54abb5c4caf5a83caa7b8adc1 /python3.html.markdown
parent0654a19b44b290828211372e8148338c4c1d1c23 (diff)
Mention that Python 2.5-style string formatting still works in 3
Diffstat (limited to 'python3.html.markdown')
-rw-r--r--python3.html.markdown4
1 files changed, 4 insertions, 0 deletions
diff --git a/python3.html.markdown b/python3.html.markdown
index 43d62e77..bc0c05bd 100644
--- a/python3.html.markdown
+++ b/python3.html.markdown
@@ -98,6 +98,10 @@ not False # => True
# You can use keywords if you don't want to count.
"{name} wants to eat {food}".format(name="Bob", food="lasagna") #=> "Bob wants to eat lasagna"
+# If your Python 3 code also needs to run on Python 2.5 and below, you can also
+# still use the old style of formatting:
+"%s can be %s the %s way" % ("strings", "interpolated", "old")
+
# None is an object
None # => None