Creating a ChainMap

  Python

Email

import collections

dict1 = {‘day1’: ‘Mon’, ‘day2’: ‘Tue’}
dict2 = {‘day3’: ‘Wed’, ‘day1’: ‘Thu’}

res= collections.ChainMap(dict1, dict2)

print(res.maps,’n’)

print(‘Keys =’, format(list(res.keys())))
print(‘values =’,format(list(res.values())))

Spread the Code

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of