google app engine - Python : parse string to sub string for searching -


my web site run on gae, want implement input-tag-box tags input box in so, search on gae required user enter whole word match.
example hello world required user enter world or hello result hello world , want when user enter word he or hel result hello world.

i looking function parse string multi sub string (implemented in python)

ex: hello world --> he hel hell hello wor worl world.

any other solution welcome.

thanks

use list comprehension , slicing:

>>> strs= "hello world" >>> [y x in strs.split() y in (x[:i] in  xrange(2,len(x)+1)) ] ['he', 'hel', 'hell', 'hello', 'wo', 'wor', 'worl', 'world'] 

Comments