替换字符 replace _string = 'hello world' new_string = _string.replace('hello', 'world') print(new_string)