python-模拟copy文件操作

#!/usr/bin/env python3

src_fname = input('please input the source file name: ')
dst_fname = input('please input the destination file name: ')

src_fobj = open(src_fname, 'rb')
dst_fobj = open(dst_fname, 'wb')

while True:
    data = src_fobj.read(4096)
    if not data:
        break
    dst_fobj.write(data)

src_fobj.close()
dst_fobj.close()
print('copy finished!')

猜你喜欢

转载自blog.csdn.net/weixin_42182501/article/details/100920519
今日推荐