import pandas as pd from pprint import pprint from Words.Phrase_dict import en_dict_with_err_or_true_mean path = r"G:\zwj\WL\en2cn\more_files\英译汉词汇非常见释义表.xlsx" # df = pd.read_excel(path, sheet_name="批改错误词汇释义整理") df = pd.read_excel(path, sheet_name="5-31") # print(df.shape) df = df.where(df.notnull(), "") words = {} for k, row in df.iterrows(): res = { "err_mean": row["错误释义"] if row["错误释义"] else "", "true_mean": row["正确释义"] if row["正确释义"] else "", } if row["英语词汇"].strip() not in en_dict_with_err_or_true_mean: words[row["英语词汇"].strip()] = res elif en_dict_with_err_or_true_mean[row["英语词汇"].strip()] != res: print(row["英语词汇"].strip()) print(res) print('=================================================') pprint(words)