Probably a very basic question, but the following code fails to replace!
h = '%3c'
c = '<'
s = 'blah %3c blah'
s.replace(h,c)
print(s)
The result is 'blah %3c blah'
.
How do I make replace treat %3c
as a normal string.
For context, I am HTML encoding and decoding strings by replacing unsafe characters with their %hex representation. I would greatly prefer to use a library for this but haven't been able to find one. As well as answering the above question, the name of such a library would be good.