If you use input()
your example works.
If you have a string variable like your example and you want to “turn it” to a raw string-like string (double escapes, in your case), you can use str.encode()
path.encode('unicode_escape')
converts "C:\path"
to "C:\\path"
1
solved Read a path from variable [closed]