(1)字符串的搜索
定义字符串s = 'hello world hello'
find找到子串,并返回最小的索引
print(s.find(‘hello’))
print(s.find(‘world’))
rfind找到子串,并返回最大的索引
print(s.rfind(‘hello’))
(2)字符串的替换
print(s.replace(‘hello’,‘westos’))
(3)字符串的对齐
print
(1)字符串的搜索
定义字符串s = 'hello world hello'
find找到子串,并返回最小的索引
print(s.find(‘hello’))
print(s.find(‘world’))
rfind找到子串,并返回最大的索引
print(s.rfind(‘hello’))
(2)字符串的替换
print(s.replace(‘hello’,‘westos’))
(3)字符串的对齐
print