方法一:使用字符串的 replace 方法 这是最简单的方法,适用于要去除的字符只有一个的情况。 python original_string = "hello world" char_to_remove = "o" new_string = original_string.replace(char_to_remove, "") print(new_string) # 输出: "hell wrld" 方法二:使用列表推导式 这种方法适用于要去...