Python: read and write binary files









def copy(if_path, of_path):
with open(if_path, 'rb') as in_file, open(of_path, 'wb') as out_file:
while True:
chunk = in_file.read(1024)
if chunk:
out_file.write(chunk)
out_file.flush()
else:
break



1 comment:

  1. I like your blog, I read this blog please update more content on python, further check it once at python online training

    ReplyDelete