If you don't want to use None as the default value, you can supply your own default : Fromkeys : Dictionary PYTHON TUTORIALS


PYTHON TUTORIALS » Dictionary » Fromkeys »

 

If you don't 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)')



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Dictionary
» Fromkeys