mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Fixes #16: Added new-style string formatting
This commit is contained in:
parent
4789dd1097
commit
a6bcf5f8d7
@ -80,6 +80,13 @@ 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")
|
||||
|
||||
# A newer way to format strings is the format method.
|
||||
# This method is the preferred way
|
||||
"{0} can be {1}".format("strings", "formatted")
|
||||
|
||||
# None is an object
|
||||
None #=> None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user