True of False
Simon Brunning
simon at brunningonline.net
Thu Sep 27 12:48:44 EDT 2007
On 9/27/07, koutoo at hotmail.com <koutoo at hotmail.com> wrote:
> I tried writing a true and false If statement and didn't get
> anything? I read some previous posts, but I must be missing
> something. I just tried something easy:
>
> a = ["a", "b", "c", "d", "e", "f"]
>
> if "c" in a == True:
> Print "Yes"
>
> When I run this, it runs, but nothing prints. What am I doing wrong?
Just use
if "c" in a:
and all will be well. The True object isn't the only truthy value in
Python - see <http://docs.python.org/lib/truth.html>.
--
Cheers,
Simon B.
simon at brunningonline.net
More information about the Python-list
mailing list