mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Mention that Python 2.5-style string formatting still works in 3
This commit is contained in:
parent
0654a19b44
commit
164cf1ce78
@ -98,6 +98,10 @@ not False # => True
|
||||
# You can use keywords if you don't want to count.
|
||||
"{name} wants to eat {food}".format(name="Bob", food="lasagna") #=> "Bob wants to eat lasagna"
|
||||
|
||||
# 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")
|
||||
|
||||
|
||||
# None is an object
|
||||
None # => None
|
||||
|
Loading…
Reference in New Issue
Block a user