Python中的单引号、双引号、三单引号、三双引号都是表示字符串的。
一.单引号:
在字符串中间出现单引号时,则需要使用转义字符,例如:
a='I\'m a boy'
print a
出现双引号时,则不用使用转义字符,例如:
a='I"m a boy'
print a
二.双引号:
出现双引号时,则需要使用转义字符,例如:
a="I\"m a boy"
print a
出现单引号时,则不用转义字符,例如:
a="I'm a boy"
print a
三.三单引号:
用于表示多行字符串
a='''I'm a boy,
hello world,
hehe'''
print a
四.三双引号:
同样用于表示多行字符串
a="""I'm a boy,
hello world,
hehe"""
print a