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
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.
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