I know that there are several posts regarding sorts of python lists, but I tried a large bunch of things and didn't accomplish to get what I want.
My code:
list = []
things = re.findall('<a class="th tooltip" data-rel=.*? href="(.*?)".*?> <img src="(.*?)" alt="(.*?)" .*?', content, re.DOTALL)
for url, image, name in things:
list.append({'url': url, 'image': image, 'name': name})
Now I want to sort this list by name. I found several posts which stated to use list.sort(key=)
but I don't know what I should use for the key. Everything I tried resulted in a KeyError
.
I'm sorry if I'm duplicating an already solved post, but I can't find the proper solution.
Thanks in advance.