Bootstrap

python笨办法学习-practice10

那是什么?-转义字符

tabby_cat = "\tI'm tabbed in."#表示空4个字符,类似于文档中的缩进功能,相当于按一个Tab键。
persian_cat = "I‘m split\non a line."#\n 后面的字符串换行输出,相当于回车键
backslash_cat = "I'm\\ a \\cat" #\\输出反斜杠

fat_cat = """
I'll do a list:
\t*Cat food
\t*Fishies
\t*Catnip\n\t*Grass
"""

print(tabby_cat)
print(persian_cat)
print(backslash_cat)
print(fat_cat)

运行结果

    I'm tabbed in.
I‘m split
on a line.
I'm\ a \cat

I'll do a list:
    *Cat food
    *Fishies
    *Catnip
    *Grass

;