这两者都是Python和stackoverflow的新手.感谢您的耐心和帮助.
我想根据列表的内容过滤一个字典,如下所示:
d={'d1':1, 'd2':2, 'd3':3} f = ['d1', 'd3'] r = {items of d where the key is in f}
这是荒谬的吗?如果没有,那么正确的语法是什么?
谢谢您的帮助.
文森特
python dictionary list filter
dictionary ×1
filter ×1
list ×1
python ×1