i need to replace the substring in the main string
mainstr='"Name":"xxx","age":"{"This":"has to","be":"replaced"}","dept":"cse"'
substr='"{"This":"has to","be":"replaced"}"'
Desired output:
mainstr="Name:xxx","age":"checked","dept":"cse"
I tried the following code:
for substr in mainstr:
mainstr=mainstr.replace(substr,"checked")
print "Output=",mainstr
On executing i got,
Output="Name:xxx","age":"{This":"has to","be":"replaced"}","dept":"cse"
Why the substr not getting replaced??..