# -*- coding: utf-8 -*-
from openpyxl.worksheet.worksheet import Worksheet
from openpyxl import load_workbook
import json

wb = load_workbook(r"单词词义表.xlsx",read_only=True)
word_dict = {}
ws: Worksheet = wb["Sheet1"]
for row in ws.values:
    _,word,frequency = row
    frequency = int(frequency)
   
    word_dict[frequency] = word
wb.close()
with open("json_word_frequency.json",mode="w",encoding="utf-8") as f:
   
    write_data = json.dumps(word_dict)
    f.write(write_data)