I am trying to write the following line for a function:
a.to_csv("~\Desktop\" + file.split('\\')[-1])
but I get
SyntaxError: EOL while scanning string literal
I also tried an f string:
a.to_csv(f"~\Desktop\{file.split('\\')[-1]}")
but I get
SyntaxError: f-string expression part cannot include a backslash
I didn't think this would be such a problem, any help would be appreciated. I am trying to extract the file name part of a path.