[Tutor] checking for substrings

reavey reavey@nep.net
Mon Dec 16 20:59:01 2002


--------------080306020703070007060506
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Sirs:

I'm confused?
 >>>"the rain in spain falls mainly on the plain"
 >>> "falls " in "the rain in spain falls mainly on the plain"
1
         #"in" looks like a yes or no test.#
 >>>a = "the rain in spain falls mainly on  the plain"
 >>> "falls" in a.split()
1
 >>>print a.find("falls")
18
 >>>a.find("falls")
18
 >>>b = "the rain in spain falls mainly on the plain in june"
Is there a way to use find to "see" the second "in" in the above example?
A reverse find?
TIA
Re-v  ?



--------------080306020703070007060506
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title></title>
</head>
<body>
Sirs:<br>
<br>
I'm confused?<br>
&gt;&gt;&gt;"the rain in spain falls mainly on the plain"<br>
&gt;&gt;&gt; "falls " in "the rain in spain falls mainly on the plain"<br>
1<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#"in" looks like a yes or no test.#<br>
&gt;&gt;&gt;a = "the rain in spain falls mainly on &nbsp;the plain"<br>
&gt;&gt;&gt; "falls" in a.split()<br>
1<br>
&gt;&gt;&gt;print a.find("falls")<br>
18<br>
&gt;&gt;&gt;a.find("falls")<br>
18<br>
&gt;&gt;&gt;b = "the rain in spain falls mainly on the plain in june"<br>
Is there a way to use find to "see" the second "in" in the above example?<br>
A reverse find?<br>
TIA<br>
Re-v &nbsp;<i>&#47803;</i><br>
<br>
<br>
</body>
</html>

--------------080306020703070007060506--