gznz12345 发表于 2017-4-21 10:16:42

python拷贝文件

  


import shutil, errno
def copyanything(src, dst):
try:
shutil.copytree(src, dst)
except OSError as exc: # python >2.5
if exc.errno == errno.ENOTDIR:
shutil.copy(src, dst)
else: raise
   代码来源:
  http://stackoverflow.com/questions/1994488/copy-file-or-directory-in-python
  还可以看看这个:
  http://stackoverflow.com/questions/123198/how-do-i-copy-a-file-in-python
页: [1]
查看完整版本: python拷贝文件