\ 轉義符,如:\'hello 輸出:hello
\n 換行 如:hello,\nworld 輸出:hello
world
\t 製表符
\\ 表示\
r'' 表示''內部的內容不轉義
'''...'''表示多行內容
例子:
# -*- coding: utf-8 -*- n = 123 f = 456.789 s1 = 'Hello, world' s2 = 'Hello, \'Adam\'' s3 = r'Hello, "Bart"' s4 = r'''Hello, Lisa!'''
代碼如下:
print('''n=123
f=456.789
s1=\'hello,world'
s2=\'hello,\\'Adam\\'\'
s3=r\'hello,\"bart\"\'
s4=r\'\'\'hello,
lisa!\'\'\'''')