Iam trying to create a list of dictionaries, but seems to me, that i am doing something wrong:
So, I have a list of tuples, something like this:
dict = {}
lst = []
cats = [(u'cat1', u'Matilda'),(u'cat2', u'Mew')]
for line in cats:
dict['cat_num'] = line[0]
dict['name'] = line[1]
lst.append(dict)
print lst
As a result I am getting this list:
[{'cat_num': u'cat2', 'name': u'Mew'}, {'cat_num': u'cat2', 'name': u'Mew'}]
Can anyone tell me where is my mistake?
Thank you.