Python Data StructureGet more with collections!
In addition to Python’s built-in data structures (such as
lists), a library module called
collections provides data structures with additional features, some of which are specializations of the built-in ones.
Import the module:
Specialized container datatypes are usually
dict subclasses or wrappers around other classes like lists, tuples, etc.
Notable implementations are :
Counterclass used for counting hashable objects.
defaultdictclass used as a faster implementation of a specialised dictionary.
namedtupleclass used for defining a meaning for every position in a tuple, often useful with databases or CSV files.
This is a post in the Python Data Structure series.
Other posts in this series: