I need a dictionary that has two keys with the same name, but different values. One way I tried to do this is by creating a class where I would put the each key name of my dictionary, so that they would be different objects:
names = ["1", "1"]
values = [[1, 2, 3], [4, 5, 6]]
dict = {}
class Sets(object):
def __init__(self,name):
self.name = name
for i in range(len(names)):
dict[Sets(names[i])] = values[i]
print dict
The result I was expecting was:
{"1": [1, 2, 3], "1": [4, 5, 6]}
But instead it was:
{"1": [4, 5, 6]}
[EDIT] So I discovered that keys in a dictionary are meant to be unique, having two keys with the same name is a incorrect use of dictionary. So I need to rethink my problem and use other methods avaliable in Python.