3条回答 默认 最新
CSDN专家-showbo 2022-05-15 14:36关注import os source=input('请输入源文件名:') target=input('请输入目标文件名:') if os.path.exists(source): tpath=os.path.dirname(target)##得到目标文件夹路径 if not os.path.exists(tpath):#不存在路径则创建 os.makedirs(tpath) r=open(source,'rb') w=open(target,'wb') while True: strb=r.read(1024) if strb==b'': break w.write(strb) r.close() w.close() else: print('%s不存在'%source)
本回答被题主选为最佳回答 , 对您是否有帮助呢?评论 打赏 举报解决 1无用