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")

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章