well, I have a little knowledge in python and I try to zip a folder
import os
import zipfile
def zipdir(path, ziph):
# ziph is zipfile handle
for root, dirs, files in os.walk(path):
for file in files:
ziph.write(os.path.join(root, file))
if __name__ == '__main__':
zipf = zipfile.ZipFile('Python.zip', 'w', zipfile.ZIP_DEFLATED)
zipdir('tmp/', zipf)
zipf.close()
so, I get this answer but I don't understand the code very well and I don't know how to implement it in my own code, I mean where should I type my folder name, for example,Test_folder, where to type it in the code to implement a zip process in it, Can you rewrite the code and type test_folder in the true place in code.