I am trying to replace certain characters with other certain characters using one .replace()
eg. I would like to replace
\u0026 with &
and
\u0027 with '
depending on which is needed to be replaced.
I am trying to replace certain characters with other certain characters using one .replace()
eg. I would like to replace
\u0026 with &
and
\u0027 with '
depending on which is needed to be replaced.
You need to have multiple .replace calls because you want to replace specific items with other specific items
If you wanted to replace any instance of \u0027 or \u0026 with just one character then you could use a single replace.
However, to achieve what you want, then you need something like this:
str.replace("\u0027","'").replace("\u0026","&")