ChainMaps in Python's collections module

PHOTO EMBED

Tue Jun 18 2024 02:31:18 GMT+0000 (Coordinated Universal Time)

Saved by @pynerds

#import the ChainMap class
from collections import ChainMap

d1 = {'one': 1, 'two': 2, 'three': 3}
d2 = {'four': 4, 'five': 5, 'six': 6}
d3 = {'seven': 7, 'eight': 8, 'nine': 9}

chain = ChainMap(d1, d2, d3)

print(chain)
content_copyCOPY

https://www.pynerds.com/python-collections-chainmap/