Re: finding an element in a string

2007-06-25 Thread Will Maier
On Mon, Jun 25, 2007 at 04:09:50PM -0400, Miguel Oliveira wrote: > I want to make an if statement in which I would like to find a > certain word in a sentence; here is what i have so far: > >x = raw_input("how are you?") > >if x == "fine": > print "Good." > > But that, obvio

Re: finding an element in a string

2007-06-25 Thread Jerry Hill
On 6/25/07, Miguel Oliveira <[EMAIL PROTECTED]> wrote: > I was looking for a way for the program to respond "good" to any sentence > that would contain the word "fine" in it. This will work for any string with the string "fine" in it. if "fine" in x: print "Good." -- Jerry -- http://mail.p

Re: finding an element in a string

2007-06-25 Thread Stephen R Laniel
On Mon, Jun 25, 2007 at 04:09:50PM -0400, Miguel Oliveira wrote: > But that, obviously, will only respond "good" when one writes "fine". I was > looking for a way for the program to respond "good" to any sentence that would > contain the word "fine" in it. What you want is a regular-expression mat