Re: Is there any way to say ignore case with "in"?

2008-04-07 Thread Mel
Paul McGuire wrote: > On Apr 6, 8:53 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: I know I could use:- if lower(string1) in lower(string2): but it somehow feels there ought to be an easier (tidier?) way. >> Take, for example, U+017F, LATIN SMALL LETTER LONG S. I

Re: Is there any way to say ignore case with "in"?

2008-04-06 Thread Paul McGuire
On Apr 6, 8:53 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > >> I know I could use:- > > >>     if lower(string1) in lower(string2): > >>         > > >> but it somehow feels there ought to be an easier (tidier?) way. > > > Easier?  You mean like some kind of mind meld? > > Interestingly enoug

Re: Is there any way to say ignore case with "in"?

2008-04-06 Thread ijoshua
On Apr 5, 7:14 am, Steve Holden <[EMAIL PROTECTED]> wrote: > 7stud wrote: > > > Easier?  You mean like some kind of mind meld? > > That's right, DWIM mode Python. Rock on! If it is common enough, define a custom type of string. I have appended a simple version that should work for your example of

Re: Is there any way to say ignore case with "in"?

2008-04-06 Thread Martin v. Löwis
>> I know I could use:- >> >> if lower(string1) in lower(string2): >> >> >> but it somehow feels there ought to be an easier (tidier?) way. >> > > Easier? You mean like some kind of mind meld? Interestingly enough, it shouldn't be (but apparently is) obvious that a.lower() in b.

Re: Is there any way to say ignore case with "in"?

2008-04-05 Thread Steve Holden
7stud wrote: > On Apr 4, 2:43 pm, [EMAIL PROTECTED] wrote: >> Is there any way in python to say >> >> if string1 in string2: >> >> >> ignoring the case of string1 and string2? >> >> I know I could use:- >> >> if lower(string1) in lower(string2): >> >> >> but it somehow fee

Re: Is there any way to say ignore case with "in"?

2008-04-04 Thread 7stud
On Apr 4, 2:43 pm, [EMAIL PROTECTED] wrote: > Is there any way in python to say > >     if string1 in string2: >         > > ignoring the case of string1 and string2? > > I know I could use:- > >     if lower(string1) in lower(string2): >         > > but it somehow feels there ought to be an easi

Re: Is there any way to say ignore case with "in"?

2008-04-04 Thread Torsten Bronger
Hallöchen! [EMAIL PROTECTED] writes: > Is there any way in python to say > > if string1 in string2: > > > ignoring the case of string1 and string2? You can "normalise" both first, i.e. converting to lower case. Tschö, Torsten. -- Torsten Bronger, aquisgrana, europa vetus

Re: Is there any way to say ignore case with "in"?

2008-04-04 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Is there any way in python to say > > if string1 in string2: > > > ignoring the case of string1 and string2? if string1.lower() in string2.lower(): ... (there's no case-insensitive version of the "in" operator in stock Python) -- http:

Is there any way to say ignore case with "in"?

2008-04-04 Thread tinnews
Is there any way in python to say if string1 in string2: ignoring the case of string1 and string2? I know I could use:- if lower(string1) in lower(string2): but it somehow feels there ought to be an easier (tidier?) way. -- Chris Green -- http://mail.python.org/m