File tree Expand file tree Collapse file tree 4 files changed +42
-0
lines changed Expand file tree Collapse file tree 4 files changed +42
-0
lines changed Original file line number Diff line number Diff line change
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/99091832-6add4280-25f6-11eb-999d-86d8b5794d57.png )
Original file line number Diff line number Diff line change
1
+ #import pyshorteners library
2
+ import pyshorteners
3
+
4
+ # input URL
5
+ url = input ("Enter the URL:" )
6
+
7
+ # class object
8
+ shortener = pyshorteners .Shortener ()
9
+
10
+ # shortened URl
11
+ urlShort = shortener .tinyurl .short (url )
12
+
13
+ # print shortened URL
14
+ print ("The shortened URL is:" + urlShort )
Original file line number Diff line number Diff line change
1
+ from zipfile import ZipFile
2
+
3
+ def main ():
4
+ # Enter the name of zip file
5
+ zipFile = input ("Enter zip file:" )
6
+ # Enter the path of the file to be extracted
7
+ extractFile = input ("Enter path of the file:" )
8
+ print ("Extracted file in ZIP to current directory" )
9
+ # create a ZipFile object in READ mode and name it as zipObj
10
+ with ZipFile (zipFile , 'r' ) as zipObj :
11
+ # extract() method is used to extract any file by specifying its path in the zip file
12
+ zipObj .extract (extractFile );
13
+
14
+ if __name__ == '__main__' :
15
+ main ()
You can’t perform that action at this time.
0 commit comments