python: How can I improve my snippet to parse elements in order
<p>I wish to find all my elements as i wish to find with in a html block and then sort it up so all every tag has it position in my list ex: ('h3', 'a', 'img')</p>

<p>I wonder if there are any better way to solve my problem in a more beautiful way and easier to extend(add more tags).</p>

<p>Ex: So I could send this list to an function with out thinking twice about it.</p>

<p>Here are the result after I run my snippet:</p>

<pre><code>[
('text 1', '/url1', '/img1.png'),
('text 2', '/url2', '/img3.png'),
('text 3', '/url3', '/img3.png'),
]
</code></pre>

<p>snippet:</p>

<pre><code>def parse_element_tag(el):
    #&lt;class 'lxml.html.HtmlElement'&gt;
    dict = {'a': (el.get('href'), 1), 'img': (el.get('src'), 2), 'h3': (el.text, 0)}
    return dict[el.tag]

requests_cache.configure('test', expire_after=900)
r = readUrl('http://www.svtplay.se/program')
l = lxml.html.fromstring(r.text)
lst = []
for el in l.cssselect('div ul.svtGridBlock li div a'):
    #lst.append(sorted([parse_element_tag(i) for i in el.iter()], key=lambda val: val[1]))
    lst.append(
               tuple([i[0] for i in sorted(
                      [parse_element_tag(i) for i in el.iter() if i.tag in ('a', 'img', 'h3')], key=lambda val: val[1]
                      )]
               ))
</code></pre>
