I have a string and 2 arrays like below:
st="a1b2c3d"
arr1 = ['1','2','3']
arr2 = ['X','Y','Z']
I want to replace all the value of '1', '2', '3' to 'X', 'Y', 'Z'. The final string will look like:
'aXbYcZd'
So I wrote this for loop:
for i in range(0, len(arr1)):
st.replace(str(arr1[i]),str(arr2[i]))
The result is:
'aXb2c3d'
'a1bYc3d'
'a1b2cZd'
How to correctly do what I want above?
Thanks!