for stallKeys in dictOfStallMenu:
if not stallKeys == "Everyday":
dictOfStallMenu[getStallName].pop(stallKeys,None)
return dictOfStallMenu
我正在尝试从字典中弹出符合条件的项目。但是,我面临着KeyError。我试图将其存储在其他词典中,然后从中弹出项目,但仍然显示错误。我该如何解决?
答案 0 :(得分:3)
您将获得一个经过以下过滤的新字典:
<SeekBar
android:id="@+id/simpleSeekBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
new_dict {k: v for k, v in my_dict.items() if my_filter(k, v)}
是一个返回布尔值(my_filter
或True
)的函数