if i have a simple list objects:
shapes = [
{
'shape': 'square',
'width': 40,
'height': 40
},
{
'shape': 'rectangle',
'width': 30,
'height': 40
}
]
How can i quickly check if a shape with value square exists? I know I can use a for loop to check each object, but is there a faster way?
Thanks in advance!
any(shape.get('shape') == 'square' for shape in shapes)