Python defaultdict from Collection Module

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Hi Rahul, thanks you very much for this video. The defaultdict can help in parsing data from a file that has multi values for the same key.

bahabenothmanbenotman
Автор

Please do you have an example for multi values in a Dictionary that has the same key? Thank you very much.
For example:


X = {'created' : 123, 'created' : 56, 'created': 77, 'created' : 99}


and I want to put all the values in a list, but the problem is in Python dictionary has only one value. Therefore, the example above it will give me just the last value key wihich is 99.
So please how we can list all values in Dictionary x


Thank you so much in advance

bahabenothmanbenotman
visit shbcf.ru