nltk_data 本地安装解压脚本

Posted on 2023-04-02 04:40  ANONY_MOUSER  阅读(40)  评论(0编辑  收藏  举报
# -*- coding: utf-8 -*-
# @Time : 2023/4/2 4:14
# @Author : yujin wang
# @Email : yujeen.wang@gmail.com

import os
import zipfile
dir_path = "C:/Users/19349/nltk_data"
for root, dirs, files in os.walk(dir_path):
for file in files:
if file.endswith(".zip"):
print(file)
file_path = os.path.join(root, file)
with zipfile.ZipFile(file_path, 'r') as zip_ref:
zip_ref.extractall(root)
print('unzip ok!')