Python dictionary removes duplicates by default But i dont want to remove duplicates
Program
s = {"a":"s","a":"b","b":"d"}
print s
Output
{'a': 'b', 'b': 'd'}
Output which is expected
{'a':'s','a':'b','b':'d'}
Python dictionary removes duplicates by default But i dont want to remove duplicates
Program
s = {"a":"s","a":"b","b":"d"}
print s
Output
{'a': 'b', 'b': 'd'}
Output which is expected
{'a':'s','a':'b','b':'d'}
You should consider using other structure. Dictionary is a key-value so for each key there is only 1 value. Try using either list of tuples or for each key in dict store a list of values.