if 'hallo' in ['hallooo','halloooooooo'] problem
Peter Hansen
peter at engcorp.com
Thu Apr 8 09:45:29 EDT 2004
Robert wrote:
> I have a little problem and mybe one of you has got the solution.
> I would like to check if a string is in a list of strings.
> The following returns true:
> if 'hallo' in ['halloooo','hallooooooooo']:
> pass
c:\>python
>>> 'hallo' in ['hallooo', 'halllloooo']
False
Given that "if" is not an expression, and so "returns" nothing
at all, please explain what you mean above... clearly the
"in" expression is behaving as you requested...
-Peter
More information about the Python-list
mailing list