Python dictionary removes duplicates by default(But i dont want to remove duplicates) -


this question has answer here:

python dictionary removes duplicates default dont want remove duplicates

program

s = {"a":"s","a":"b","b":"d"} print s 

output

{'a': 'b', 'b': 'd'} 

output expected

{'a':'s','a':'b','b':'d'} 

you should consider using other structure. dictionary key-value each key there 1 value. try using either list of tuples or each key in dict store list of values.


Comments