本文整理汇总了Python中search.Search.walk方法的典型用法代码示例。如果您正苦于以下问题:Python Search.walk方法的具体用法?Python Search.walk怎么用?Python Search.walk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类search.Search
的用法示例。
在下文中一共展示了Search.walk方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: search_files
# 需要导入模块: from search import Search [as 别名]
# 或者: from search.Search import walk [as 别名]
def search_files():
keyword = request.GET.get('w')
if len(keyword) > 0:
keyword = keyword.strip()
s = Search(os.getcwd(), keyword.decode("utf-8"), ("*.markdown", "*.md"))
result = s.walk()
result = [x for x in result if x[1] is not None]
result = map(lambda x : [x[0][len(os.getcwd()):len(x[0])], x[1]], result)
return dict(results = result, keyword = keyword, request = request)
示例2: search_files
# 需要导入模块: from search import Search [as 别名]
# 或者: from search.Search import walk [as 别名]
def search_files():
keyword = request.GET.get("w")
if len(keyword) > 0:
keyword = keyword.strip()
s = Search(os.getcwd(), keyword.decode("utf-8"), ("*.markdown", "*.md"))
result = s.walk()
result = [x for x in result if x.items is not None]
newresult = []
for x in result:
x = SearchResult(x.fullpath[len(os.getcwd()) : len(x.fullpath)], x.items)
x.name = extract_file_title_by_fullurl(x.fullpath)
newresult.append(x)
return dict(results=newresult, keyword=keyword, request=request, is_logined=is_logined())