0
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.

TessellatingHeckler
  • 27,511
  • 4
  • 48
  • 87
Ajaykumar
  • 3
  • 1
  • 2

1 Answers1

1

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

Testing001
  • 61
  • 2
  • OP brought it up, but it's worth mentioning the `str.remove` does not exist. The correct way to do this would be `new_file_name.replace('\\', '')` – philosofool Aug 07 '22 at 17:00
  • sorry, it was wrong I didn't pay attention to the data type. thank you for correcting me – Testing001 Aug 08 '22 at 02:49