tabby_cat = "\t I'm tabbed in."
persian_cat = "I'm split\non a line."
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)
練習(xí)
- Memorize all the escape sequences by putting them on flash cards.
- Use ''' (triple-single-quote) instead. Can you see why you might use that instead of """ ?
- Combine escape sequences and format strings to create a more complex format.