I already referred to the docs, but I can’t seem to extract this associative-array or dictionary:
# errors = session.pop('_flashes')
# repr(errors)
[('message', [u'Content is empty'])]
when I Do:
repr(errors['message'])
I’m getting an error instead:
TypeError: list indices must be integers, not str
What am I doing wrong?
is not a dict. It is a list of tuple(s).
You can convert it to dict easily:
dcontains now{'message': [u'Content is empty']}and access its elements:
returns
[u'Content is empty']or directly down to the string:
returns
u'Content is empty'