summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam Bard <github@adambard.com>2018-08-01 20:47:55 -0700
committerGitHub <noreply@github.com>2018-08-01 20:47:55 -0700
commitacb72a414a80cfa0f8a3b25fcafd363b70d9e7fe (patch)
treee89d1bed51fc2fd64dc081995e8db6cea278eede
parent51d86629acda7617486e2f921b49523ecc078815 (diff)
parentb6aed7a0b38bf189922dbc47ed802de3c9769b73 (diff)
Merge pull request #3171 from lowlevelware/master
[python3/en] added example for f-string
-rw-r--r--python3.html.markdown4
1 files changed, 4 insertions, 0 deletions
diff --git a/python3.html.markdown b/python3.html.markdown
index 019934cb..d6cfbf59 100644
--- a/python3.html.markdown
+++ b/python3.html.markdown
@@ -138,6 +138,10 @@ len("This is a string") # => 16
# still use the old style of formatting:
"%s can be %s the %s way" % ("Strings", "interpolated", "old") # => "Strings can be interpolated the old way"
+# You can also format using f-strings or formatted string literals
+name = "Reiko"
+f"She said her name is {name}." # => "She said her name is Reiko"
+
# None is an object
None # => None