本文整理汇总了Python中OutputManager.OutputManager.searchEverythingPrint方法的典型用法代码示例。如果您正苦于以下问题:Python OutputManager.searchEverythingPrint方法的具体用法?Python OutputManager.searchEverythingPrint怎么用?Python OutputManager.searchEverythingPrint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputManager.OutputManager
的用法示例。
在下文中一共展示了OutputManager.searchEverythingPrint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: searchEverything
# 需要导入模块: from OutputManager import OutputManager [as 别名]
# 或者: from OutputManager.OutputManager import searchEverythingPrint [as 别名]
def searchEverything(self, substr):
'''
this function searches for a substring, it doesn't matter if it is in title, content or tags, if there are results
they will be printed.
:param substr:
:return:
'''
titleMatch = self._searchInTitleImpl(substr)
tagMatch = self._searchInTagsImpl(substr)
contentMatch = self._searchInMushroomImpl(substr)
generalMatch = []
title = {}
tag = {}
content = {}
for element in titleMatch:
title[str(element[0])] = str(element[1])
for element in tagMatch:
tag[str(element[0])] = [str(element[1]), element[2]]
for element in contentMatch:
content[str(element[0])] = [str(element[1]), element[2]]
generalMatch = set(title.keys() + tag.keys() + content.keys())
for element in generalMatch:
if element in tag.keys() and element in content.keys():
OutputManager.searchEverythingPrint(
element,
content[element][0],
tag,
content[element][1])
elif element in content.keys():
OutputManager.searchEverythingPrint(
element,
content[element][0],
None,
content[element][1])
elif element in tag.keys():
OutputManager.searchEverythingPrint(
element,
tag.values()[0][0],
tag.values()[0][1])
elif element in title.keys():
OutputManager.searchEverythingPrint(element, title.values()[0])
else:
print "nothing found"