0

For a given str of the form:

"""hello this is a dict '{"test":"test"}', this is an id '123'."""

output:

'hello this is a dict \'{"test":"test"}\', this is an id \'123\'.'

is there a way to remove the \ so the output will be:

'hello this is a dict '{"test":"test"}', this is an id '123'.'
gbox
  • 809
  • 1
  • 8
  • 22
  • 1
    Note that the output you are seeing is artifactual, in that the single quotes are only escaped to make the string literal valid in Python. The backslashes are not really there. – Tim Biegeleisen Nov 08 '22 at 10:52
  • This answer your question: https://stackoverflow.com/questions/17327202/python-replace-single-backslash-with-double-backslash – Will Nov 08 '22 at 11:15

0 Answers0