I have an Excel file WK6 that is downloaded in the below folder:
C:\Users\kj\Scripts\Sh\Result\Wk6
The Python script should first navigate till the above directory and then find the excel file WK6 (the name of the excel file changes as per week) and compress it. Then move it to some other directory.
Please help me understand how can I find and compress the file in python?
for zipping the file you can use following:
from zipfile import ZipFile
import os
path = r'C:\Users\kj\Scripts\Sh\Result\Wk6'
os.chdir(path)
ZipFile('<new path>/name.zip', 'w').write('Wk6.csv')