How to populate a dictionary in python
This code shows how to populate a dictionary, using the built-in method setdefault.
If the key does not exist, it will be created setting its value too.
Otherwise the new value will be appended to the existing ones.
In this way the key existence in automatically checked by python during run time.
post this code
keyName = 'myNewKey'
txtData = 'some data'
If you want to be updated about similar snippets,
and follow our Channels