可用于windows或者linux系统
拷贝文件的同时可以重命名
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
import os.path
from shutil import copy
print("在linux系统中输入文件路径必须加双引号,windows系统不用此操作 ")
source = input("Enter source file with full path: ")
target = input("Enter target file with full path: ")
copy(source, target)
#try:
# copyfile(source, target)
#except IOError as e:
# print("Unable to copy file. %s" % e)
# exit(1)
#except:
# print("Unexpected error:", sys.exc_info())
# exit(1)
print("\nFile copy done!\n")