Data
I suppose that you have a dictionary like this:
item = {
'light_missing': 1,
'dark_missing': 0,
'pixel_missing': 0,
'light': 0,
'dark': 1,
'pixel': 1
}
Computation
And you want to filter it, getting only the objects with a key ending with 'missing', like this:
for key, value in item.items():
if key.endswith('missing'):
print(key, value)
Or, if you want your result as a list:
result = [(key, value) for key, value in item.items() if key.endswith('missing')]
Output
The output from this snippet is:
light_missing 1
dark_missing 0
pixel_missing 0
Or, if used the "list alternative";
[('light_missing', 1), ('dark_missing', 0), ('pixel_missing', 0)]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…