《笨办法学python》源码 Ex10.py



#-------------------------------------------------------------------------------
# Name:        ex_10.py
# Purpose:     转义字符.引号特殊用法.
#
# Author:      huanghuan
#
# Created:     14-08-2013
# Copyright:   (c) huanghuan 2013
# Licence:     <your licence>
#-------------------------------------------------------------------------------

# 转义字符
tabby_cat = "\tI'm tabbed in."
persian_cat = "I'm split\non a line."
backslash_cat = "I'm \\ a \\ cat."

# 3双引号对.字符串.
fat_cat = """
I'll do a list:
\t* Cat food
\t* Fishies
\t* Catnip\n\t* Grass
"""

# 3单引号对.字符串.
fat_cat2 = '''
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
print fat_cat2





你可能感兴趣的:(《笨办法学python》源码 Ex10.py)