Hi I am trying to escape a single quotation between specific text.
My String
a = "{'content': 'Roberto Delacruz'}"
If I use this command
a=a.replace(r"'", r"\'")
It gives me following output
"{\\'content\\': \\'Roberto Delacruz\\'}"
How to I escape a single quote between this string
content':''
Any single quote between above specified text should be escaped.
Example: content':'O'Cornor' (This name has single quote).
Some Additional Explanation My Actual String looks like this "[('name', 'product'), ('type', 'html'),('content', 'O'Cornor')]" O'Cornor is a name of person which will be inside the single quotation. Also this name has single Quote also. I need to escape this Single Quote only. This string will be utilized in Command line
python -m myscript.py "[('name', 'product'), ('type', 'html'),('content', 'O'Cornor')]"