Ad

How To Remove '\' Symbol From A String In PYTHON

- 1 answer

new_filename_name = new_filename_name.remove("\")

How can I use '\' symbol normally in python? no matter how I use this symbol it interprets it as a command like \n.

Ad

Answer

You can say to interpreter (python) for escaping the symbol by adding this symbol --> \\

so your syntax be like this:

new_filename_name = new_filename_name.remove("\\")

It same as ignoring another symbol:

"\\n" --> for escaping the \n

example escaping the \n

Ad
source: stackoverflow.com
Ad