Is there a way to prevent Python from recognizing escape characters?

Question:

Code:

import os
filename = "cp.lnk"
lnk = "shortcutscmd_shortcuts" + filename
os.system(lnk)

And that gives me this error, I’m assuming, because it recognizes escape quotes in the variable:

‘shortcuts’ is not recognized as an internal or external command,
operable program or batch file.

I then tried:

import os
filename = "cp.lnk"
lnk = r"shortcutscmd_shortcuts" + filename
os.system(lnk)

It game me the same error. How can I fix this?

Thank you!

Edit: Sorry my question was so bad ):

Asked By: Elliot Harrell

||

Answers:

Pretty sure that should fix it but don’t quote me on that.

import os
filename = "cp.lnk"
lnk = r"shortcuts\cmd_shortcuts\" + filename
os.system(lnk)
import os
filename = "cp.lnk"
lnk = "shortcuts\cmd_shortcuts\" + filename
os.system(lnk)
Answered By: Ellis Ollier
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.