On Wed, 07 Feb 2007 13:09:00 -0800, Don Morrison wrote:

> string.find is deprecated as per the official python documentation.
> 
> take a look at the "re" module

Regular expressions are way, WAY overkill for a simple find. Just use
the string methods. Instead of this:

import string
string.find("Norwegian Blue", "Blue")


just do this:

"Norwegian Blue".find("Blue")

For case insensitive find:

"Norwegian Blue".lower().find("Blue".lower())

(or better still, turn it into a function).


-- 
Steven D'Aprano 

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

Reply via email to