Güngör Budak's Blog

Bioinformatics, web programming, coding in general

Python: defaultdict(list) Dictionary of Lists

Most of the time, when you need to work on large data, you’ll have to use some dictionaries in Python. Dictionaries of lists are very useful to store large data in very organized way. You can always initiate them by initiating empty lists inside an empty dictionary but when you don’t know how many of them you’ll end up with and if you want an easier option, use defaultdict(list). You just need to import it, first:

Read more →