Mega Code Archive
Categories
/
Python Tutorial
/
Dictionary
Create dictionary from fromkeys() function
print {}.fromkeys('xyz') print {}.fromkeys(('love', 'honor'), True) # More Than One Entry per Key Not Allowed dict1 = {' foo':789, 'foo': 'xyz'} print dict1 dict1['foo'] = 123 print dict1