I have a string of the type ../sometext/someothertext, and I’m trying to replace the .. in the string with the name of a website http://www.website.com.
In Python, what I’ve done is like so :
strName = "../sometext/someothertext"
strName.replace("..", "http://www.website.com")
print strName
But the only output I get is
../sometext/someothertext
I’ve also tried escaping the periods, like
strName = ../sometext/someothertext
strName.replace("\.\.", "http://www.website.com")
but the output doesn’t change. How do I do this?
You didn’t assign the result…
.replacedoesn’t modify the original string but returns a new string with the modifications.