Dec-24-2021, 10:13 PM
(Dec-24-2021, 10:01 PM)BashBedlam Wrote: Is this what you're looking for?
products = ['id', 'name', 'producer','category','price', 'stock'] list1 = [ { "id": "1", "name": "predator", "producer": "acer", "category": "laptop", "price": 1000, "stock": 5 }, { "id": "2", "name": "monitor1", "producer": "dell", "category": "monitor", "price": 500, "stock": 10 } ] product_name = input('Enter the name of product: ') for el in list1: if el ['name'] == product_name : for key, value in el.items () : if key != 'name' : print (key, value)
yes, it's perfect
thanks!