問題:
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?