You can download this code by clicking the button below.
This code is now available for download.
This function is used to copy all the contents of one file into another.
Technology Stack : Built-in library
Code Type : File operation
Code Difficulty : Intermediate
def zip_file(input_file, output_file):
with open(input_file, 'rb') as f_in:
with open(output_file, 'wb') as f_out:
while True:
chunk = f_in.read(1024)
if not chunk:
break
f_out.write(chunk)
return output_file