[Tutor] RE: string.search
Wed, 5 Dec 2001 14:52:10 -0000
The square brackets indicate optional items, thus all you
Which searches for t1 within t2. It returns the location
of t1 within t2 or -1 if not there.
You can limit the range of the search using the optional items so
you could do:
t2.search(t1,3) # search from the 4 character of t2 to the end
t2.search(t1,3,7) # search from the 4th character to the 8th.
BTW I haven't checked that this is absolutely correct so read
the docs again...I'm too old fashioned and still use the string
module functions rather than the new string methods.
The principle of what I'm saying is correct tho...