Mega Code Archive

 
Categories / Python Tutorial / Dictionary
 

If you dont want to use None as the default value, you can supply your own default

print dict.fromkeys(['name', 'age'])  print dict.fromkeys(['name', 'age'], '(unknown)')