[Tutor] List comparisons
Jonathan Hayward
jonathan.hayward at pobox.com
Fri Sep 24 21:32:31 CEST 2004
Is there a good way to tell if a potential sublist is in another list?
I'm doing the following:
for index in range(len(document_tokens) -
len(self.tokenized)):
if document_tokens[index:index +
len(self.tokenized)] == \
self.tokenized:
match_found = 1
but that seems lower level than one would expect of Python.
--
++ Jonathan Hayward, jonathan.hayward at pobox.com
** To see an award-winning website with stories, essays, artwork,
** games, and a four-dimensional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com
More information about the Tutor
mailing list