main.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:nweb 作者: pierce403 项目源码 文件源码
def search():
  q = request.args.get('q')
  if not q:
    q=''
  f = request.args.get('f')
  try:
    p = int(request.args.get('p'))
  except:
    p = 0

  try:
    fmt=request.args.get('f')
    print(fmt)
  except:
    fmt=""

  count,context = nweb.search(q,100,100*int(str(p)))

  # what kind of output are we looking for?
  if fmt == 'hostlist':
    print("printing hostlist because "+fmt)
    return render_template("hostlist.html",query=q, numresults=count, page=p, hosts=context)

  # default output (a pretty webpage)
  return render_template("search2.html",query=q, numresults=count, page=p, hosts=context)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号