If I use the following line:
shutil.copyfile(r\"\\\\mynetworkshare\\myfile.txt\",\"C:\\TEMP\\myfile.txt\")
everything works fine. However, what
The r
is for "raw string", not for relative. When you don't prefix your string with r
, Python will treat the backslash "\
" as an escape character.
So when your string contains backslashes, you either have to put an r
before it, or put two backslashes for each single one you want to appear.
>>> r"\\myfile" == "\\\\myfile"
True