When you use tuples are dictionary keys they have to be used fully to reference that value.
In your case (11,22)
is a key. And you may not use them separately to identify values.
Tuples are used as keys when both its elements mean something together.
For example : {(<first_name>,<last_name>): <money_owed>}
Why elements of tuples as keys wouldn't be right?
Eg : {('John','Well'):100, ('John','Mann'):200}
Here the first_name
s are both John and we use a tuple to uniquely identify the key.
What you want is like a list
as a key and you may not have a list
as a dictionary key
.
What you may do is keep them separate(different keys with same value):
{11: 35, 22: 35, 44:12, 45:12}
Refer : Dict keys in python
You may use this method(you will get issues if you have repetition of key elements, and if you do have repetitions you shouldn't use elements in the tuples to identify values):
l=[]
for x in a:
for i in x:
l.append({i:a[x]})
With this you get an output like: [{11: 35}, {22: 35}, {44:12}, {45:12}]
Then you may us it as a list of dictionaries.