finding a value in a tuple
skip at pobox.com
Thu Nov 29 22:16:37 CET 2001
Dan> Say I have
Dan> mylist = ['one','two','three']
Dan> which I presume is a "tuple" as I have been scanning the manual.
Actually, it's a list. You can think of a list as a mutable tuple for most
uses (or a tuple as an immutable list).
Dan> I want to know if one of the values in that tuple is exactly equal
Dan> to "four". The answer of course is no, but how would I find it.
>>> mylist = ['one','two','three']
>>> "four" in mylist
>>> "one" in mylist
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)
More information about the Python-list