import shutil
# 复制
# 1. shutil.copyfileobj(源文件管家,目标文件管家)
# 只能复制文件的内容,无法复制权限
# x = open("/etc/hosts", mode="r")
# y = open("/opt/myhosts", mode="w")
# shutil.copyfileobj(x, y)
# x.close()
# y.close()
# 2. shutil.copyfile(源文件路径, 目标文件路径)
# 只能复制文件的内容,无法复制权限
# shutil.copyfile("/usr/bin/ls", "/opt/myls")
# 3. shutil.copy(源文件路径, 目标文件路径)
# 既能复制文件的内容,也能复制权限
shutil.copy("/usr/bin/ls", "/opt/myls2")



