this should work<br><br><br>def find_value(value, lst):<br>    for obj in lst:<br>        if value in obj.values():<br>            return obj<br><br>&gt;&gt; find_value(&quot;aaa&quot;, my_lst)<br><br>Vince<br><br><div class="gmail_quote">
On Thu, Jul 23, 2009 at 9:55 AM,  <span dir="ltr">&lt;<a href="mailto:davidwilson@safe-mail.net">davidwilson@safe-mail.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
hello,<br>
please excuse me, but i would like to understand how dictionaris work.<br>
<br>
for example:<br>
&gt;&gt;&gt; my_lst = [{&#39;code&#39;: &#39;aaa&#39;, &#39;name&#39;: &#39;a name&#39;}, {&#39;code&#39;: &#39;bbb&#39;, &#39;name&#39;: &#39;b name&#39;}]<br>
&gt;&gt;&gt; my_code = &#39;aaa&#39;<br>
<br>
<br>
from the above i would like to compare my_code and return the dictionary which has code == my_code<br>
<br>
dave<br>
_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
</blockquote></div><br>