mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-26 23:23:55 +00:00
Merge pull request #1504 from dillonjbyrne/patch-1
[python3/en] Cleaned up formatting and clarified output
This commit is contained in:
commit
ae4e4e81f4
@ -119,7 +119,7 @@ b == a # => True, a's and b's objects are equal
|
||||
"This is a string"[0] # => 'T'
|
||||
|
||||
# .format can be used to format strings, like this:
|
||||
"{} can be {}".format("strings", "interpolated")
|
||||
"{} can be {}".format("Strings", "interpolated") # => "Strings can be interpolated"
|
||||
|
||||
# You can repeat the formatting arguments to save some typing.
|
||||
"{0} be nimble, {0} be quick, {0} jump over the {1}".format("Jack", "candle stick")
|
||||
@ -130,7 +130,7 @@ b == a # => True, a's and b's objects are equal
|
||||
|
||||
# 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")
|
||||
"%s can be %s the %s way" % ("Strings", "interpolated", "old") # => "Strings can be interpolated the old way"
|
||||
|
||||
|
||||
# None is an object
|
||||
@ -154,7 +154,7 @@ bool({}) #=> False
|
||||
####################################################
|
||||
|
||||
# Python has a print function
|
||||
print("I'm Python. Nice to meet you!")
|
||||
print("I'm Python. Nice to meet you!") # => I'm Python. Nice to meet you!
|
||||
|
||||
# By default the print function also prints out a newline at the end.
|
||||
# Use the optional argument end to change the end character.
|
||||
|
Loading…
Reference in New Issue
Block a user