string.find for case insensitive search

2007-02-07 Thread Johny
Is there a good way how to use string.find function to find a substring if I need to you case insensitive substring? Thanks for reply LL -- http://mail.python.org/mailman/listinfo/python-list

Re: string.find for case insensitive search

2007-02-07 Thread Duncan Booth
Johny [EMAIL PROTECTED] wrote: Is there a good way how to use string.find function to find a substring if I need to you case insensitive substring? s.lower().find(substring.lower()) -- http://mail.python.org/mailman/listinfo/python-list

Re: string.find for case insensitive search

2007-02-07 Thread Don Morrison
lower() is also deprecated :) oh well On 7 Feb 2007 21:06:08 GMT, Duncan Booth [EMAIL PROTECTED] wrote: Johny [EMAIL PROTECTED] wrote: Is there a good way how to use string.find function to find a substring if I need to you case insensitive substring? s.lower().find(substring.lower())

Re: string.find for case insensitive search

2007-02-07 Thread Bruno Desthuilliers
Johny a écrit : Is there a good way how to use string.find function to find a substring if I need to you case insensitive substring? abCdZEd.lower().find(BcD.lower()) -- http://mail.python.org/mailman/listinfo/python-list

Re: string.find for case insensitive search

2007-02-07 Thread Larry Bates
Johny wrote: Is there a good way how to use string.find function to find a substring if I need to you case insensitive substring? Thanks for reply LL Maybe something like: x=my string I'm going to SEarCH hasword='SEARCH' in x.upper() location=x.upper().find('SEARCH') print hasword True

Re: string.find for case insensitive search

2007-02-07 Thread Don Morrison
string.find is deprecated as per the official python documentation. take a look at the re module On 7 Feb 2007 12:53:36 -0800, Johny [EMAIL PROTECTED] wrote: Is there a good way how to use string.find function to find a substring if I need to you case insensitive substring? Thanks for reply

Re: string.find for case insensitive search

2007-02-07 Thread Robert Kern
Don Morrison wrote: lower() is also deprecated :) oh well The string method .lower() is not deprecated. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying

Re: string.find for case insensitive search

2007-02-07 Thread Duncan Booth
Don Morrison [EMAIL PROTECTED] wrote: lower() is also deprecated :) oh well On 7 Feb 2007 21:06:08 GMT, Duncan Booth [EMAIL PROTECTED] wrote: Johny [EMAIL PROTECTED] wrote: Is there a good way how to use string.find function to find a substring if I need to you case insensitive

Re: string.find for case insensitive search

2007-02-07 Thread Don Morrison
My apologies, I confused the built-in str with the module string. I was reading from the section of the 2.4.4 docs called: 4.1.4 Deprecated string functions On 2/7/07, Robert Kern [EMAIL PROTECTED] wrote: Don Morrison wrote: lower() is also deprecated :) oh well The string method .lower() is

Re: string.find for case insensitive search

2007-02-07 Thread Steve Holden
Don Morrison wrote: string.find is deprecated as per the official python documentation. but the str.find() method isn't. take a look at the re module A possibility. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com

Re: string.find for case insensitive search

2007-02-07 Thread Don Morrison
Don Morrison wrote: string.find is deprecated as per the official python documentation. but the str.find() method isn't. take a look at the re module A possibility. regards Steve Thank you everyone. :) Johny did say string.find in his message, not str.find, but continue to proceed

Re: string.find for case insensitive search

2007-02-07 Thread Steven D'Aprano
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