Telegram Group & Telegram Channel
📦 Архивация в Python всего за несколько строк

Никаких сторонних библиотек — всё делает встроенный модуль zipfile

import zipfile

def make_zip(target_files: list[str], zip_name: str = 'data.zip') -> None:
"""Упаковывает файлы в ZIP-архив с указанным именем."""
with zipfile.ZipFile(zip_name, 'w') as archive:
for filename in target_files:
archive.write(filename) # Добавляем файл в архив
print(f" Архив {zip_name} создан!")

make_zip(['image.png', 'notes.md'])


👨‍💻 Удобно для логов, бэкапов или автосборки. Хороший вариант для скриптов, где надо временно упаковать кучу файлов.

📂 Сохраняй, пригодится!

#python #code
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/python2day/6773
Create:
Last Update:

📦 Архивация в Python всего за несколько строк

Никаких сторонних библиотек — всё делает встроенный модуль zipfile

import zipfile

def make_zip(target_files: list[str], zip_name: str = 'data.zip') -> None:
"""Упаковывает файлы в ZIP-архив с указанным именем."""
with zipfile.ZipFile(zip_name, 'w') as archive:
for filename in target_files:
archive.write(filename) # Добавляем файл в архив
print(f" Архив {zip_name} создан!")

make_zip(['image.png', 'notes.md'])


👨‍💻 Удобно для логов, бэкапов или автосборки. Хороший вариант для скриптов, где надо временно упаковать кучу файлов.

📂 Сохраняй, пригодится!

#python #code

BY [PYTHON:TODAY]




Share with your friend now:
tg-me.com/python2day/6773

View MORE
Open in Telegram


PYTHON:TODAY Telegram | DID YOU KNOW?

Date: |

Why Telegram?

Telegram has no known backdoors and, even though it is come in for criticism for using proprietary encryption methods instead of open-source ones, those have yet to be compromised. While no messaging app can guarantee a 100% impermeable defense against determined attackers, Telegram is vulnerabilities are few and either theoretical or based on spoof files fooling users into actively enabling an attack.

The messaging service and social-media platform owes creditors roughly $700 million by the end of April, according to people briefed on the company’s plans and loan documents viewed by The Wall Street Journal. At the same time, Telegram Group Inc. must cover rising equipment and bandwidth expenses because of its rapid growth, despite going years without attempting to generate revenue.

PYTHON:TODAY from us


Telegram [PYTHON:TODAY]
FROM USA