prefix search on a large file

Scott David Daniels scott.daniels at acm.org
Thu Oct 12 21:18:56 CEST 2006


Try:

     def leaders(sorted_list):
         held = None
         for phrase in held:
             if held is None or not phrase.startswith(held):
                 held = row
                 yield held

     print list(leaders(sorted(data)))

--Scott David Daniels
scott.daniels at acm.org



More information about the Python-list mailing list