iana
iana

Reputation: 11

extraction of dictionary in python

I currently have [x for x in if '' in x] for extraction but not sure what to add in

Upvotes: 0

Views: 44

Answers (1)

bereal
bereal

Reputation: 34282

You can use a list comprehension with a condition, e.g:

[country for country, colours in flag_colours.items() if len(colours) > 2]

Upvotes: 7

Related Questions