summaryrefslogtreecommitdiffhomepage
path: root/python.html.markdown
diff options
context:
space:
mode:
authorVipul Sharma <vipulsharma936@gmail.com>2015-10-20 09:57:53 +0530
committerVipul Sharma <vipulsharma936@gmail.com>2015-10-20 09:57:53 +0530
commita6eb459b611b67132c76e34095afd87a5aada78c (patch)
treeb55797a428a42ee3804a00c3eeb5171e90e211f6 /python.html.markdown
parentb354013dc9bcba5e76bd3cf720eae8af7d9eba89 (diff)
Modified string format [python/en]
Diffstat (limited to 'python.html.markdown')
-rw-r--r--python.html.markdown7
1 files changed, 5 insertions, 2 deletions
diff --git a/python.html.markdown b/python.html.markdown
index 42a52bcf..01e5d481 100644
--- a/python.html.markdown
+++ b/python.html.markdown
@@ -123,8 +123,11 @@ not False # => True
# A string can be treated like a list of characters
"This is a string"[0] # => 'T'
-# % can be used to format strings, like this:
-"%s can be %s" % ("strings", "interpolated")
+#String formatting with %
+#Even though the % string operator will be deprecated on Python 3.1 and removed later at some time, it may still be #good to know how it works.
+x = 'apple'
+y = 'lemon'
+z = "The items in the basket are %s and %s" % (x,y)
# A newer way to format strings is the format method.
# This method is the preferred way