Multiple dictionaries causing AttributeError?

I have 1 variable that contains multiple dictionaries:

a = {"foo": "foo"}, {"foo2": "foo2"}

But if I do:


it returns as AttributeError:

AttributeError: 'tuple' object has no attribute 'get'


Multiple dictionaries does not exist in Python. If you define a as:

a = {"foo": "foo"}, {"foo2": "foo2"}

a will be a tuple. So you have to call the element as follow:


To use a.get method you have to define a as follow:

a = {"foo": "foo", "foo2": "foo2"}

Now a.get("foo") call will have as output "foo".

You're assigning to variable a tuple of two elements which are dicts.


a = {"foo": "foo"}, {"foo2": "foo2"}

is equivalent to:

a = ({"foo": "foo"}, {"foo2": "foo2"})

so you cannot access to dictionary in this way you try.

AttributeError: 'tuple' object has no attribute 'get'

tells you that you want to use get attribute on tuple, but tuple hasn't it.

Solving issue:

You can assign to a variable for example one dict:

a = {"foo": "foo", "foo2": "foo2"}

and in this case you can use:


which will print


Need Your Help

ListView Item is not clickable in Android

android listview onitemclicklistener

In this ListView is not clickable, I want to perform an action on item click but I do not know why this is not clickable, I have also checked in debugging the controller is not gone in itemclicklis...

Making image buttons on select few

javascript html css button hyperlink

So I'm doing a site, where the viewers will be able to go in and look at dresses that are for sale. When they first load the page, an image is put into the div "Dress" and thats the front of the dr...