Your code is saying to replace each instance of '\' with result. Have you tried changing it to result.replace("\\", "") ?
14
votes
Use decode('string_escape'), for example:
result = stringwithbackslashes.decode('string_escape')
string_escape : Produce a string that is suitable as string
literal in Python source code
or just:
result.replace("\\", "")
6
votes
result = result.replace("\\", "")
2
votes
If you are interested in seeing the component words that are being separated by the '\' character, use:
result.replace('\\', ' ')
0
votes
Try This:
result = result.replace("\\", "")
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more