【python基础字符串】

1.在python中使用单引号或者双引号括起来的就是字符串。
2. # 使用6个单引号或双引号 使字符串所见即所得
3.在python2中,字符串分为两种类型,第一种是str,第二种是unicode,他们都是继承自basestring。
4.在python3中,字符串分为两种类型,第一种是bytes,是python2中的str,是一种字节码,第二种是str,是python2中的unicode

a = 12
b = 'hello'
c = "world"

print(type(a))
print(type(b))
print(type(c))

greet = 'hello\
world'
print(greet)                # 使用‘\’来进行显示在下一行,并不是换行。


greet = '''
	咏鹅
	鹅鹅鹅,曲项向天歌
	白毛浮绿水,红掌拨清波。
'''
print(greet)            

 

posted @ 2019-07-06 20:47  水果、、  阅读(210)  评论(0编辑  收藏  举报