Re: [Tutor] checking substrings in strings

2005-08-25 Thread Alan G
I would like to check if a certain word exists in a given string. since I learned to love lists, I used if myword in mystring: ...didnt work. I have now resorted to Which version of Python? 'boo' in 'mybigbooboo' True Works for me in Python 2.4... Alan G. (Regular readers will

Re: [Tutor] checking substrings in strings

2005-08-25 Thread John Fouhy
On 8/25/05, Frank Hoffsümmer [EMAIL PROTECTED] wrote: Hello, I would like to check if a certain word exists in a given string. since I learned to love lists, I used if myword in mystring: ...didnt work. What version of python are you using? This was introduced in Python 2.3.

[Tutor] checking substrings in strings

2005-08-24 Thread Frank Hoffsümmer
Hello, I would like to check if a certain word exists in a given string. since I learned to love lists, I used if myword in mystring: ...didnt work. I have now resorted to if mystring.find(myword) 1: is this really the canonical way to check if myword exists in mystring? it feels somewhat