過濾字典以僅包含某些鍵? - Filter dict to contain only certain keys?

問題:

I've got a dict that has a whole bunch of entries.我有一個dict ,裏面有一大堆條目。 I'm only interested in a select few of them.我只對其中的幾個感興趣。 Is there an easy way to prune all the other ones out?有沒有簡單的方法來修剪所有其他的?


解決方案:

參考一: https://stackoom.com/question/ELjG
參考二: Filter dict to contain only certain keys?
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章