zl程序教程

您现在的位置是:首页 >  后端

当前栏目

[Python] Format Strings in Python

Python in format strings
2023-09-14 08:59:17 时间

Single quotes and double quotes can both be used to declare strings in Python. You can even use triple-double quotes! Learn when to use each in this lesson as well as variable substitution in strings.

 

foo = 'What is up'

foo = 'What\'s up'

foo = "What's up"

foo = """ what's up
man
!"""

 

color = 'red'
thing = 'book'
print('this is {0} {1}'.format(color, thing))