Python ChainMap Demo: Combining multiple Dictionaries containing emoji unicode values

preview_player
Показать описание
In this video we look at a Python program that demonstrates the collections ChainMap a data structure that combines multiple dictionaries and treats them as one large dictionary. The program reads a list of JSON files and uses the chain map's new_child method to add each dictionary to the chainMap. Next it demoes how the chainMap now acts as a single dictionary. We can access a single value using its key. Or we can use the items() method just as in a simple dictionary and loop over the key-value pairs. In this particular example the key-value pairs correspond to an emoji description (key) and the corresponding hexcode unicode (value).
Рекомендации по теме