¡@

Home 

python Programming Glossary: search_str

Searching for a string in a large text file - profiling various methods in python

http://stackoverflow.com/questions/6219141/searching-for-a-string-in-a-large-text-file-profiling-various-methods-in-pytho

task manager 1 set i data set f.read .splitlines ii result search_str in data Load time ~ 10s Search time ~ 0.0s Memory usage ~ 1.2GB.. usage ~ 1.2GB 2 list i data f.read .splitlines ii result search_str in data Load time ~ 6s Search time ~ 0.36s Memory usage ~ 1.2GB.. f.fileno 0 access mmap.ACCESS_READ ii result data.find search_str Load time ~ 0s Search time ~ 5.4s Memory usage ~ NA 4 Hash lookup..

What's the most efficient way to find one of several substrings in Python?

http://stackoverflow.com/questions/842856/whats-the-most-efficient-way-to-find-one-of-several-substrings-in-python

example import re def work to_find re.compile cat fish dog search_str blah fish cat dog haha match_obj to_find.search search_str the_index.. search_str blah fish cat dog haha match_obj to_find.search search_str the_index match_obj.start # produces 5 the index of fish which_word_matched.. words first middle last words 0 words len words 2 words 1 search_string s s s last middle first match_obj search_for.search search_string..