1
file_name = file_path.split('\')

Gives me an error because \' is to represent a single quote in python.

I want to split a file name using single backslash.

martineau
  • 119,623
  • 25
  • 170
  • 301
Shiv
  • 19
  • 1

1 Answers1

2

Use a double \:

file_name = file_path.split('\\')
Red
  • 26,798
  • 7
  • 36
  • 58