python 在后台提取 zip

python zip extraction in background

我正在将大型 zip 文件上传到系统中。其中 zip 提取可能需要几分钟。我想将此 zip 提取发送到后台,因为不想阻止 UI.

_.unzip(filePath ,uploadPath) #is it possible to make it async or independent?

使用threading模块!

import threading

def do_unzipping():
    _.unzip(filePath ,uploadPath)

    update_ui("Unzipping Finished!")

threading.Thread(target = do_unzipping).start()
continue_with_unblocked_ui()

Nice threading tutorial.