使用Python从本地驱动器复制到映射的sharepoint驱动器

2024-10-01 13:24:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我已将我们的Sharepoint目录映射到桌面上的本地驱动器。在

如何使用Python将文件从同一台计算机上的另一个本地驱动器复制到该映射驱动器?在

一个简单的代码和所有必要的导入定义将是非常感谢。我对Python很陌生。在

谢谢。在

我试过了

import os
import os.path
import shutil
import sys
import win32wnet
from shutil import copyfile

src = 'C:\mydirectorypath\art.txt'

dst = 'Z:\somefile.txt'

copyfile(src,dst)

这给了我一个错误:

raise SpecialFileError("%s is a named pipe" % fn) with open(src, 'rb') as fsrc: with open(dst, 'wb') as fdst: copyfileobj(fsrc, fdst)

IOError: [Errno 22] invalid mode ('rb') or filename: 'C:\mydirectorypath\x07rt.txt'


Tags: importsrctxtosaswithopendst