Search that returns array of founds in wxPython?
in wxPython Styled text, There is a FindText that finds first occurrence of text searched. Is there a wa开发者_运维问答y to find all occurrences and put them into list or dict in one go?
If there's no built-in function, you can just use re.finditer on the contents of the StyledTextCtrl:
import re
full_text = my_stc.GetText()
search_string = 'a string to find'
matches = [i.start() for i in re.finditer(search_string, full_text)]
精彩评论