📌  相关文章
📜  如何在python代码示例中查找字符串中最后一次出现的字符

📅  最后修改于: 2022-03-11 14:46:01.388000             🧑  作者: Mango

代码示例1
original_string = "sentence one. sentence two. sentence three"

last_char_index = original_string.rfind(".")
new_string = original_string[:last_char_index] + "," + original_string
print(new_string)
"sentence one. sententce two, sentence three"