python的字符串基本操作

str = 'changsha'

print(str)
print(str[0])
print(str[0:5])
print(str[0:8:2])
print(str[:5])
print(str[5:])
print(str + ",你好")
print(str * 3)

print("hello\tworld")
print(r"hello\tworld")

 

posted @ 2020-05-21 16:01  chuyaoxin  阅读(170)  评论(0编辑  收藏  举报