Overview:
- The operator |, when applied on a Python dictionary object d1 with another dictionary object d2 as the parameter, merges the contents of both the dictionaries into a new dictionary and returns the new dictionary.
Example:
# Example Python program that merges to python dictionaries # Dictionary one # Dictionary two # Merge two dictionaries # Print the merged dictionaries |
Output:
{'US': 'USD', 'Europe': 'EUR', 'Japan': 'JPY', 'England': 'GBP', 'Australia': 'AUD', 'Canada': 'CAD', 'Switzerland': 'CHF', 'China': 'CNH', 'Hong Kong': 'HKD', 'New Zealand': 'NZD'} |