Python Sisipkan teks dalam string sebelum simbol tertentu

my_str = "thisissometextthatiwrote"
substr = "text"
inserttxt = "XX"

idx = my_str.index(substr)
my_str = my_str[:idx] + inserttxt + my_str[idx:]
Fragile Finch