"in" operator for strings

Tim Peters tim.one at home.com
Sat Feb 3 05:28:34 CET 2001

[Magnus Lie Hetland]
> ...
> What's the built-in string-matching algorithm in Python?
> (Not very important to me, but...)

Brute force, using memcmp.  Note that fancier algorithms that require
precomputing tables of size proportional to the alphabet cardinality aren't
very attractive in a Unicode world.

See mxTextTools for a Boyer-Moore 8-bit string searcher.

More information about the Python-list mailing list