diff options
author | Divay Prakash <divayprakash@users.noreply.github.com> | 2018-10-12 03:54:35 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-12 03:54:35 +0530 |
commit | 195c17ab2da24e6bc2ddb75256fcd95c1efebab6 (patch) | |
tree | d8bd97b301a0225088314be9e9feb530c813b923 | |
parent | 2a9c2f0c7bd232940bfdcaf69738af0466685875 (diff) | |
parent | 56258dfb72c17192d1963d56da6aaf12624b3e43 (diff) |
Merge pull request #3284 from juniorRubyist/patch-1
[python3/en] Add f-string clarification. (supported in Python 3.6 or better)
-rw-r--r-- | python3.html.markdown | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/python3.html.markdown b/python3.html.markdown index b378a8c6..7683bc60 100644 --- a/python3.html.markdown +++ b/python3.html.markdown @@ -139,9 +139,11 @@ 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 +# You can also format using f-strings or formatted string literals (in Python 3.6+) name = "Reiko" f"She said her name is {name}." # => "She said her name is Reiko" +# You can basically put any Python statement inside the braces and it will be output in the string. +f"{name} is {len(name)} characters long." # None is an object |