3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by vegaseat
1

hi,
here's a small example illustrating the find function:

s = """This is an example
string searching method."""

word = "searching"
print s.find( word )
# -> 26
# and some documentation for the function:

#Help on built-in function find:

#find(...)
#    S.find(sub [,start [,end]]) -> int
    
#    Return the lowest index in S where substring sub is found,
#    such that sub is contained within s[start:end].  Optional
#    arguments start and end are interpreted as in slice notation.
    
#    Return -1 on failure.

you should check vegaseat's example on highlighting words in text, I think it is in here:

http://www.daniweb.com/forums/thread191210-8.html

hope this gives you some ideas :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.