You can download this code by clicking the button below.
This code is now available for download.
This function reads a file and writes its content to another file, serving as a file compression function.
Technology Stack : Built-in file operations
Code Type : File operation
Code Difficulty : Beginner
def zip_file(input_path, output_path):
with open(input_path, 'rb') as f_in:
with open(output_path, 'wb') as f_out:
f_out.write(f_in.read())