1、加,乘
>>> 'hello'+'world'
'helloworld'
>>> 'hello'*3
'hellohellohello'
2、字符串运算(一)
>>> 'hello world'[0]
'h'
>>> 'hello world'[4]
'o'
>>> 'hello world'[-1] [-n]是指从末尾字符开始往前数第n个字符
'd'
>>> 'hello world'[-3]
'r'
3、字符串运算(二)
>>> 'hello world'[0:3] [0:3]截取第0位到第2位字符
'hel'
>>> 'hello world'[0:-1] -1是步长的概念
'hello worl'
>>> 'hello world'[0:-3]
'hello wo'
4、字符串运算(三)
>>> 'hello world'[6:11]
'world'
>>> 'hello world'[6:20]
'world'
>>> 'hello world'[6:]
'world'
>>> 'hello world'[-5:]
'world'