question about True values

Fredrik Lundh fredrik at pythonware.com
Wed Oct 25 15:21:01 EDT 2006


John Salerno wrote:

> I'm a little confused. Why doesn't s evaluate to True in the first part, 
> but it does in the second? Is the first statement something different?
> 
>  >>> s = 'hello'
>  >>> s == True
> False
>  >>> if s:
> 	print 'hi'

"true" != "True".  comparing a value to another value isn't the same 
thing as interpreting a value in a specific context:

     http://docs.python.org/lib/truth.html

</F>




More information about the Python-list mailing list