Python - Replace two characters in the middle of a string

Description

Replace two characters in the middle of a string

Demo

S = 'abcdefghijk' 
S = S[:3] + 'xx' + S[5:]          # Slice sections from S 
print( S )

Result

Related Topic