def force_copy(src, dest):
 if os.path.isfile(dest):
  os.remove(dest)
 if os.path.isdir(dest):
  dest = os.path.join(dest, os.path.basename(src))
 shutil.copyfile(src, dest)
 return dest

def force_copy ( src , dest ) : if os . path . isfile ( dest ) : os . remove ( dest ) if os . path . isdir ( dest ) : dest = os . path . join ( dest , os . path . basename ( src ) ) shutil . copyfile ( src , dest ) return dest
replace dest with a new copy of src .