1.replace replace函数用于替换字符串中的某个字符或字符串,只替换第一个匹配项。例如: str = "hello world" new_str = str.replace("o", "a") print(new_str) # 输出 "hella world" 2.replaceall函数用于替换字符串中的所有匹配项。例如: str = "hello w