Skip to content

Commit 7e5c020

Browse files
authored
Merge pull request mouredev#7373 from pyramsd/reto#41
mouredev#41 - python
2 parents 803856d + 5ffffc2 commit 7e5c020

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import zipfile
2+
3+
def compress_file(file_path, output_zip):
4+
with zipfile.ZipFile(output_zip, 'w', zipfile.ZIP_DEFLATED) as zipf:
5+
zipf.write(file_path, arcname=file_path.split("/")[-1])
6+
7+
file = "D:\\Programacion\\comandos importantes de git.txt"
8+
output = "archivo.zip"
9+
10+
compress_file(file, output)
11+
print(f"Archivo comprimido creado: {output}")

0 commit comments

Comments
 (0)