views:

40

answers:

2

How do I remove all the backslashes from a string in Python?

This is not working for me:

result = result.replace("\\", result)

Do I need to treat result as a raw string?

+4  A: 

Your code is saying to replace each instance of '\' with result. Have you tried changing it to result.replace("\\", "") ?

FallingBullets
+1  A: 
result = result.replace("\\", "")
unbeli