if 'hallo' in ['hallooo','halloooooooo'] problem
Vrai Stacey
spam.trap.vrai.stacey at spam.trap.kbcfp.com
Thu Apr 8 09:56:54 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
What version of Python are you using? With 2.2.3 I get the behavior you
want using your first example.
So ...
> if 'hallo' in ['halloooo','hallooooooooo']: print "Hallo!";
> if 'hallo' in ['halloooo','hallo' ]: print "Hallo!";
Hallo!
vrai.
More information about the Python-list
mailing list