fromkeys in dictionary in python code example
Example 1: dictionary function fromkeys in python
key = { "India", "Austria", "USA", "Pakistan", "Czech Republic"}
value = "Country"
countries = dict.fromkeys(key, value) # function fromkeys
counties
#returns {'USA': 'Country',
'Pakistan': 'Country',
'Austria': 'Country',
'India': 'Country',
'Czech Republic': 'Country'}
Example 2: dict.fromkeys in python
for fruit, color in test.items():
# do stuff