Python中的單引號(hào)''篷牌,雙引號(hào)"",三引號(hào)""" """,或者''' ''' 都可以用來包含字符串踏幻,三引號(hào)包含的字符串可由多行組成枷颊,一般可表示大段的敘述性字符串。在使用時(shí)基本沒有差別该面,但雙引號(hào)和三引號(hào)("""...""")中可以包含單引號(hào)夭苗,三引號(hào)('''...''')可以包含雙引號(hào),而不需要轉(zhuǎn)義隔缀。
示例:
>>> x = 'I am alex'
>>> print(x)
I am alex
>>> y = "I'm alex"
>>> print(y)
I'm alex
>>> z = '''Be the change
... you want to see in the world!'''
>>> print(z)
Be the change
you want to see in the world!