Suppose i have this list:<br />
<br />
>>> a = [['cat',2],['cat',5],['cat',9],['dog',6]]<br />
>>> a<br />
[['cat', 2], ['cat', 5], ['cat', 9], ['dog', 6]]<br />
<br />
Now, there is a nice way to obtain the value 9.<br />
<br />
>>> z = dict(a)<br />
>>> z<br />
{'dog': 6, 'cat': 9}<br />
<br />
Is there any elegant way to extract the value 2? (Value corresponding to the first occurence of 'cat' in the 2-D list).<br />
<br />
Thanks,<br />
Vikram<br><Table border=0 Width=644 Height=57 cellspacing=0 cellpadding=0 style="font-family:Verdana;font-size:11px;line-height:15px;"><TR><td><A HREF="http://sigads.rediff.com/RealMedia/ads/click_nx.ads/www.rediffmail.com/signatureline.htm@Middle?" target="_blank"><IMG SRC="http://sigads.rediff.com/RealMedia/ads/adstream_nx.ads/www.rediffmail.com/signatureline.htm@Middle"></A></td></TR></Table>