import zipfile inpath = MyDirPath outpath = inpath.replace(".zip", "") # Remove zip extension so that outpath does not have .zip with zipfile.ZipFile(inpath, 'r') as z: z.extractall(outpath) # Extracts