开发者

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)]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜