[Tutor] or

Rick Pasotto rickp@telocity.com
Tue, 25 Jun 2002 13:48:03 -0400


On Tue, Jun 25, 2002 at 05:40:03PM +0000, Terje Johan Abrahamsen wrote:
> I have the following:
> >>>ffac.xlpol =u'NAB02658508'
> 
> Then I try:
> >>>if ffac.xlpol[0] == u's' or u'S':
> ... 	print"yes"
> ...
> yes
> 
> This is clearly wrong. If I remove the or and the last u'S' it works. How 
> can I get it to do the if statement if either u's' or u'S' is correct?

It is clearly *correct*. u'S' is always true.

What you probably meant to write was 

>>> if ffac.xlpol[0] == u's' or ffac.slpol[0] == u'S':

or perhaps

>>> if ffac.xlpol[0] in (u's',u'S'):

-- 
"One of the symptoms of an approaching nervous breakdown is the
belief that one's work is terribly important."
		-- Bertrand Russell
    Rick Pasotto    rickp@telocity.com    http://www.niof.net