Removing backslashes from a string in Python

前端 未结 4 1945
挽巷
挽巷 2020-12-11 14:33

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

This is not working for me:

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

4条回答
  •  囚心锁ツ
    2020-12-11 15:17

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

提交回复
热议问题