:optionallyyou can pass folder name to extractall(to have it extract the files into folder other than the current working directory if the folder passed to the extractall(method does not existit will be created for instanceif you replaced the call at with examplezip extractall(' :\delicious')the code would extract the files from example zip into newly created :\delicious folder the extract(method for zipfile objects will extract single file from the zip file continue the interactive shell exampleexamplezip extract('spam txt'' :\\spam txtexamplezip extract('spam txt'' :\\some\\new\\folders'' :\\some\\new\\folders\\spam txtexamplezip close(the string you pass to extract(must match one of the strings in the list returned by namelist(optionallyyou can pass second argument to extract(to extract the file into folder other than the current working directory if this second argument is folder that doesn' yet existpython will create the folder the value that extract(returns is the absolute path to which the file was extracted creating and adding to zip files to create your own compressed zip filesyou must open the zipfile object in write mode by passing 'was the second argument (this is similar to opening text file in write mode by passing 'wto the open(function when you pass path to the write(method of zipfile objectpython will compress the file at that path and add it into the zip file the write(method' first argument is string of the filename to add the second argument is the compression type parameterwhich tells the computer what algorithm it should use to compress the filesyou can always just set this value to zipfile zip_deflated (this specifies the deflate compression algorithmwhich works well on all types of data enter the following into the interactive shellimport zipfile newzip zipfile zipfile('new zip'' 'newzip write('spam txt'compress_type=zipfile zip_deflatednewzip close(this code will create new zip file named new zip that has the compressed contents of spam txt keep in mind thatjust as with writing to fileswrite mode will erase all existing contents of zip file if you want to simply add files to an existing zip filepass 'aas the second argument to zipfile zipfile(to open the zip file in append mode organizing files