Merge pull request #3171 from lowlevelware/master

[python3/en] added example for f-string
This commit is contained in:
Adam Bard 2018-08-01 20:47:55 -07:00 committed by GitHub
commit acb72a414a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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