Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to replace a character from a string from a index

stra = 'Meatloaf'
posn = 5
nc = 'x'

stra = string[:posn] + nc + string[posn+1:]
print(stra)
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #replace #character #string #index
ADD COMMENT
Topic
Name
5+1 =