import os import zipfile def unzip(zip_file): zip_filename = zip_file target_dir = 'img' if not os.path.exists(target_dir): os.makedirs(target_dir) with zipfile.ZipFile(zip_filename, 'r') as zip_ref: zip_ref.extractall(target_dir)