我想做一個名爲remove_short_synonyms()的函數,它傳遞了一個字典 作爲參數。參數字典的鍵是單詞,對應的值是同義詞列表。該功能可刪除同義詞的每個對應列表 以下的所有同義詞,其中的同義詞少於7個字符。python - 從字典中刪除值
如果是這樣的字典:
synonyms_dict = {'beautiful' : ['pretty', 'lovely', 'handsome', 'dazzling', 'splendid', 'magnificent']}
如何我得到這個作爲輸出?
{beautiful : ['dazzling', 'handsome', 'magnificent', 'splendid']}
你到目前爲止試過了什麼? –