编辑代码

s = 'hello'; print(s[0])
s = 'hello' ; print(s[0:3]) 
s = 'hello kitty' ; print(s[0:4:2])   
s = 'guoke wang' ;print(s[-1])  
s = 'guoke wang' ; print(s[:2])
s = 'hello world' ; print(s[:-1])
s = 'hello' ; print(s[::-1]) 
s = 'hello' ; print(s[1:]) 
s = 'hello' ; print(s[:])  
s='happy';print(s*3) 
s='happy';print(s+'world')
s='happy';print(s+'world')
s='happy';print('a' in s)
print('today is sunday'.startswith('h'))
print('today is sunday'.endswith('ya'))
print('today is sunday'.endswith('ay'))