Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to compress and back up multiple files by zipfile

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Zipfile how to compress and back up multiple files, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

Compress backup multiple files using zipfile to create compressed files view information extract import os import shutilos.getcwd ()'C:\\ Users\\ coop'# create import zipfilemy_zip = zipfile.ZipFile ('coop.zip',' w') # create object Write to file # my_zip.writemy_zip.write ('how to compress backup multiple files .ipynb', compress_type = zipfile.ZIP_DEFLATED) my_zip.write ('three major object-oriented features .ipynb', compress_type = zipfile.ZIP_DEFLATED) my_zip.close () # View coop = zipfile.ZipFile ('coop.zip') coop.namelist () [' how to compress backup multiple files .ipynb' 'three major object-oriented features. Ipynb'] coop.getinfo ('how to compress and back up multiple files. Ipynb') coop.close () shutil.copy ('coop.zip',' coop_1.zip') 'coop_1.zip'# decompress coop = zipfile.ZipFile (' coop_1.zip') coop.extractall ('D:\ python full site') # optional parameters in parentheses You can make the current directory, or you can specify the directory coop.close (). Will it be helpful for you to finish reading the above contents? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report