我正在尝试将文件保存到映射的网络驱动器Z:&我得到的错误是SyntaxError:'横向扫描字符串时'EOL'。我已经在本地驱动器上尝试了此代码,没有任何问题。有关引用映射的共享驱动器的所有提示。
with open ('test.txt','r') as file:
text = file.read()
with open(' Z:\\example.job.com@SSL\site\more\specific\folder\files','w') as file:
file.write(text)
您没有逃脱反斜线吗?尝试:
directory = r"Z:\\example.job.com@SSL\site\more\specific\folder\files"
with open ('test.txt','r') as file:
text = file.read()
with open(directory,'w') as file:
file.write(text)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句