Gilles Ganault wrote:
> test = "t...@gmail.com"
> isp = ["gmail.com", "yahoo.com"]
> for item in isp:
> if test.find(item):
> print item
> ======= output
> gmail.com
> yahoo.com
> =======
> 
> Any idea why I'm also getting "yahoo.com"?

find() returns the index where it is found or -1 if it is not found. Both an
index>0 or a -1 evaluate to True when used as conditional expression.

Uli

-- 
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to