Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python insert text in string before certain symbol

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

idx = my_str.index(substr)
my_str = my_str[:idx] + inserttxt + my_str[idx:]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #insert #text #string #symbol
ADD COMMENT
Topic
Name
1+7 =