Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python string replace index

# strings are immutable in Python, 
# we have to create a new string which 
# includes the value at the desired index

s = s[:index] + newstring + s[index + 1:]
 
PREVIOUS NEXT
Tagged: #python #string #replace #index
ADD COMMENT
Topic
Name
2+6 =