Let me modify this example:<div><br></div><div><div>a = [['jimmy', '25', 'pancakes'], ['tom', '23', 'brownies'], ['harry', '21', 'cookies']]</div><div>
for i in a:</div><div>    <b>b = i[0]</b></div><div>    if (i[1] == '25' or i[1] == '26'):</div><div>        print <b>b</b></div><div>    else:</div><div>        print 'Not found'</div><div><br></div>
<div>This will output:</div><div><b>jimmy</b></div><div><b>Not found</b></div><div><b>Not found</b></div><div><b><br></b></div><div>How do I print positive matches (<b>jimmy</b>) only and not (<b>Not found</b>). I also want <b>Not found </b>to print only <i>once </i>if there are no positive matches.</div>
<div><br>On Wednesday, October 24, 2012, Saad Javed  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<div><br></div><div><div>a = [['jimmy', '25', 'pancakes'], ['tom', '23', 'brownies'], ['harry', '21', 'cookies']]</div>
<div>for i in a:</div><div>    if (i[1] == '25' or i[1] == '26'):</div>
<div>        print 'yes'</div><div>else:</div><div>    print 'Not found'</div></div><div><br></div><div>This prints:</div><div>yes</div><div>not found</div><div><br></div><div>I want it to print "yes" for each positive match but nothing for a negative match. However if all matches are negative, I want it to print "Not found" once (That bit the code already does). I do I get it to print "yes" only in a mix result situation?</div>

<div><br></div><div>Saad</div>
</blockquote></div></div>