| 123456789101112131415161718192021222324252627 |
- import zipfile
- import os
- import time
- def unzipfile_and_remove(downloadFilePath, filename):
- filepath = downloadFilePath + "\\" + filename + ".zip"
- while not os.path.exists(filepath):
- time.sleep(1)
- if os.path.isfile(filepath):
- zip_ref = zipfile.ZipFile(filepath, "r")
- zip_ref.extractall(downloadFilePath)
- zip_ref.close()
- os.remove(filepath)
- else:
- raise ValueError("%s isn't a file!" % filepath)
|