Skip to content

Commit 0b2d024

Browse files
author
akashgiricse
committed
Finished help material for the file organization
1 parent 8e4a13b commit 0b2d024

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

HelpMaterial/organizingFiles.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,19 @@
9696

9797
# Extracting from ZIP Files
9898

99+
import zipfile, os
100+
exampleZip = zipfile.ZipFile('/home/rango/Downloads/Create-a-blog.zip')
101+
#extract file to /home/rango/Download
102+
exampleZip.extractall('/home/rango/Downloads')
103+
exampleZip.close()
104+
105+
# Creating and Adding to ZIP Files
106+
import zipfile
107+
108+
# create a new ZIP file named new.zip that compresses contents of spam.txt
109+
newZip = zipfile.ZipFile('new.zip','w')
110+
newZip.write('spam.txt', compress_type=zipfile.ZIP_DEFLATED)
111+
newZip.close()
112+
113+
114+

0 commit comments

Comments
 (0)