复杂list/dict结构的超简单字符串搜索库
fynd的Python项目详细描述
财政年度
fynd
makes it super simple to search for strings in complex list/dict (JSON like) data structures. It returns a list of paths from root of the data structure to the found strings.
安装
pip install fynd
用法
fromfyndimportFyndasfyndCOLLECTION={'blogposts':[{'title':'Lorem Ipsum','text':'Dolor Sit Amet Blah Blah Blah'},{'title':'Brown Fox','text':'The quick brown fox jumps over blah'}]}# default usage:RESULT=fynd('blah').inside(COLLECTION)# ^ will return,# [# ['blogposts', 0, 'text'], # ^ COLLECTION['blogposts'][0]['text'] == 'Dolor Sit ... Blah'# ['blogposts', 1, 'text']# ^ COLLECTION['blogposts'][1]['text'] == 'The quick ... blah'# ]# case sensitive usage:RESULT=fynd('blah').case_sensitive().inside(COLLECTION)# ^ will return,# [# ['blogposts', 1, 'text']# ^ COLLECTION['blogposts'][1]['text'] == 'The quick ... blah'# ]# not found case:RESULT=fynd('hulalala').inside(COLLECTION)# ^ will return,# [] an empty list
元
- 许可证:麻省理工学院
- 作者:Ahmed Noor
- 来源:https://github.com/ahmednooor/fynd