Python - 简单复制.csv文件出错

时间:2018-03-12 13:31:10

标签: python csv shutil

我只使用shutil.copyfile将.csv从网络路径复制到本地路径:

from shutil import copyfile
import os.path
import _datetime as dt

fileCsv = "VDOCUMENT.csv"

srcPath = r"\\reports\"
dstPath = r"C:\Audit1\"

copyfile(os.path.join(srcPath, fileCsv), os.path.join(dstPath, fileCsv))

错误:

Traceback (most recent call last):
File "C:/Users/cvmsouz/Desktop/test/00_MoveCSV.py", line 16, in <module>
copyfile(os.path.join(srcPath, fileCsv), os.path.join(dstPath, fileCsv))
File "C:\Users\cvmsouz\AppData\Local\Continuum\Anaconda3\lib\shutil.py", line 120, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '\\\\reports\\VDOCUMENT.csv'

1 个答案:

答案 0 :(得分:0)

问题实际上是愚蠢的:网络文件的名称与本地文件不同。

如果有需要学习的东西,因为每个人都有好处,就是创造标准人物。