Python programming

Noah Hall enalicho at gmail.com
Wed Dec 22 20:43:30 EST 2010


The most Pythonic ways of checking if a value is within a list is to use the
"in" keyword, for example, using your data -
5 in [2, 6, 5]
Which will return True, as 5 is in the list. You can then use this in the
following generic way -
if variable in list:

do_things

Where variable is the varible you wish to seek, and the list is the list you
wish to search.

Might I also suggest that you use the *tutor*@*python*.org mailing list,
where people are perhaps more ready to handle this sort of question.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101223/b7157b12/attachment.html>


More information about the Python-list mailing list