'''
# 15.编写简易版本的拷贝工具
# 自己输入想要拷贝的数据路径
# 自己输入拷贝到哪个地方的目标路径
# 任何类型数据皆可拷贝
# ps: 个别电脑C盘文件由于权限问题可能无法拷贝
# 换其他盘尝试即可
'''
source_file_path = input('请输入你要复制的的数据路径>>>:')
target_file_path = input('请输入你要粘贴到那个地方路径>>>:')
#二进制模式下
with open(r'%s' % source_file_path, 'rb') as read_file, open(r'%s' % target_file_path, 'wb') as write_file:
data = read_file.read()
write_file.write(data)
#文本模式下
with open(r'%s' % source_file_path, 'r', encoding='utf8') as read_file, open(r'%s' % target_file_path, 'w', encoding='utf8') as write_file:
data = read_file.read()
write_file.write(data)
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/272814.html