Skip to content

sachinsachdeva/pymultimap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pymultimap

PyPI - Version PyPI - Python Version


Table of Contents

MultiMap

Python based Dictionary with support for duplicate keys and sorted data based on keys

Installation

pip install pymultimap

Usage

from pymultimap.multimap import MultiMap

mm = MultiMap()
mm["a"] = 1
mm["a"] = 2
mm["b"] = 3

print(mm)

Should print :
{a: [1, 2], b: [3]}
from pymultimap.multimap import MultiMap

sorted_multimap = MultiMap(sorted=True, reverse=True)
sorted_multimap["a"] = 1
sorted_multimap["c"] = 3
sorted_multimap["b"] = 2

print(sorted_multimap)

Should print :
{c: [3], b: [2], a: [1]}

License

pymultimap is distributed under the terms of the MIT license.