- 字符串的定义法
(1)单引号
(2)双引号
(3)三引号
python
name = 'doinb'
print(type(name), name)
name = "doinb"
print(type(name), name)
name = """doinb"""
print(type(name), name)
name = """
super
carry
doinb
"""
print(type(name), name)
- 引号的嵌套
(1)单引号中出现双引号
(2)双引号中出现单引号
(3)转义字符
python
name = '"doinb"'
print(name)
name = "'doinb'"
print(name)
name = "\'doinb\'"
print(name)
name = '\"doinb\"'
print(name)
name = '\"\'doinb\'\"'
print(name)