Skip to content

Commit ffbdd82

Browse files
authored
Merge pull request #363 from Sapna2001/extract
extract files from zip in python
2 parents f7c0002 + a7d44ee commit ffbdd82

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Extract contents of a specified path of ZIP file
2+
3+
A script to extract all the contents of a specified path of ZIP file.
4+
5+
## How to use this script?
6+
Just type the following in your command prompt:
7+
8+
python script.py
9+
10+
## Screenshot
11+
After running the script we will find the extracted file in the current directory.
12+
13+
![demo](https://user-images.githubusercontent.com/56690856/99141235-5b4e1000-266f-11eb-8798-a0315a0f834c.png)
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from zipfile import ZipFile
2+
3+
def main():
4+
# Enter the path of the zip file
5+
zipFile = input("Enter zip file:")
6+
print("Extracted file in ZIP to current directory")
7+
# create a ZipFile object in READ mode and name it as zipObj
8+
with ZipFile(zipFile, 'r') as zipObj:
9+
# extractall the files from a zip file
10+
zipObj.extractall();
11+
12+
if __name__ == '__main__':
13+
main()

0 commit comments

Comments
 (0)