Why does Python show the whole array?
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Thu Apr 9 21:31:28 EDT 2009
In message <grk6ch$73v$00$1 at news.t-online.com>, Peter Otten wrote:
> Lawrence D'Oliveiro wrote:
>
>> In message <o0tot492cfjj2g180p15irievp6crpc4ih at 4ax.com>, Gilles Ganault
>> wrote:
>>
>>> test = "toto at gmail.com"
>>> isp = ["gmail.com", "yahoo.com"]
>>> for item in isp:
>>> if test.find(item):
>>> print item
>>> ======= output
>>> gmail.com
>>> yahoo.com
>>> =======
>>
>> This is why conditional constructs should not accept any values other
>> than True and False.
>
> So you think
>
> if test.find(item) == True: ...
>
> would have been better?
That won't work either. Can anyone tell us what he's done wrong?
More information about the Python-list
mailing list