PYTHONPORTAL Telegram 4379
Как заархивировать файлы в Python за 5 строк

Стандартный модуль zipfile делает всё просто:

import zipfile

files = ['file1.txt', 'file2.txt']
with zipfile.ZipFile('pycl.zip', 'w') as zipf:
for file in files:
zipf.write(file)

print("ZIP file created!")


На выходе — pycl.zip с нужными файлами.

Полезно для бэкенда, автосборки, логов 💪

👉 @PythonPortal
Please open Telegram to view this post
VIEW IN TELEGRAM
👍67🔥1611🌚1



tgoop.com/PythonPortal/4379
Create:
Last Update:

Как заархивировать файлы в Python за 5 строк

Стандартный модуль zipfile делает всё просто:

import zipfile

files = ['file1.txt', 'file2.txt']
with zipfile.ZipFile('pycl.zip', 'w') as zipf:
for file in files:
zipf.write(file)

print("ZIP file created!")


На выходе — pycl.zip с нужными файлами.

Полезно для бэкенда, автосборки, логов 💪

👉 @PythonPortal

BY Python Portal




Share with your friend now:
tgoop.com/PythonPortal/4379

View MORE
Open in Telegram


Telegram News

Date: |

“[The defendant] could not shift his criminal liability,” Hui said. End-to-end encryption is an important feature in messaging, as it's the first step in protecting users from surveillance. In handing down the sentence yesterday, deputy judge Peter Hui Shiu-keung of the district court said that even if Ng did not post the messages, he cannot shirk responsibility as the owner and administrator of such a big group for allowing these messages that incite illegal behaviors to exist. With the “Bear Market Screaming Therapy Group,” we’ve now transcended language. How to Create a Private or Public Channel on Telegram?
from us


Telegram Python Portal
FROM American