本文整理汇总了Python中search.Search.setTerm方法的典型用法代码示例。如果您正苦于以下问题:Python Search.setTerm方法的具体用法?Python Search.setTerm怎么用?Python Search.setTerm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类search.Search
的用法示例。
在下文中一共展示了Search.setTerm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Search
# 需要导入模块: from search import Search [as 别名]
# 或者: from search.Search import setTerm [as 别名]
# enables colored error messages to appear in browser.
from search import Search
# imports methods from class Search
form = cgi.FieldStorage()
term = form.getvalue("term", "")
# sets term to 'term' or else defaults 'term' to an empty string
print "Content-type: text/html\n"
print "<html>"
print """
<form method= 'GET' action= " ">
Search Titles For: <input type='text' name = 'term'/>
<input type = 'submit' />
</form>"""
# generates from that accepts keyword search term
if term:
titles = Search()
titles.setTerm(term)
result = titles.searchTitle()
print "<h3> Search Term Is: %s</h3>" % term
print result
else:
print "No search entered"
print "</html>"