i'm just learning python and i have a problem. how can i print multiple indexes of a certain value in a dictionary? In particular I want to print the index of each element of the dictionary_title array which has gender_ids as key.
dictionary_title={
{'label': 'Green', 'genre_ids': 878},
{'label': 'Pink', 'genre_ids': 16},
{'label': 'Orange', 'genre_ids': 28},
{'label': 'Yellow', 'genre_ids': 9648},
{'label': 'Red', 'genre_ids': 878},
{'label': 'Brown', 'genre_ids': 12},
{'label': 'Black', 'genre_ids': 28},
{'label': 'White', 'genre_ids': 14},
{'label': 'Blue', 'genre_ids': 28},
{'label': 'Light Blue', 'genre_ids': 10751},
{'label': 'Magenta', 'genre_ids': 28},
{'label': 'Gray', 'genre_ids': 28}}This is my code:
for values in dictionary_title["genre_ids"]:
for item in values:
if item == 28:
print(values.index(item)) For example i want print index:2,6,8,10,11 which are the indexes of the items with the key genre_ids=28. How can i do?
In 2025, service-based businesses need professional SEO services to stand out. With 1.3M monthly searches for “SEO services” and 20K for “local SEO,” NaugSEO offers affordable SEO solutions to rank your website on Google’s first page. Our expert SEO company uses on-page and off-page optimization, targeting high-volume keywords like “affordable SEO” (15K searches). From local SEO to voice search optimization, our best SEO strategies for 2025 ensure visibility in AI overviews. Get started with an SEO plan for just $99/month. Visit NaugSEO for customized SEO solutions and skyrocket your leads with SEO optimisation and marketing help. Book your free audit today!