本文整理汇总了Python中page.Page.find方法的典型用法代码示例。如果您正苦于以下问题:Python Page.find方法的具体用法?Python Page.find怎么用?Python Page.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类page.Page
的用法示例。
在下文中一共展示了Page.find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import find [as 别名]
def main():
""""""
mainUrl = "http://events.cnbloggercon.org/event/cnbloggercon2007/"
content = Page(mainUrl).Content
soup = BeautifulSoup(content)
links = soup("a")
peopleList = []
for item in links:
href = item["href"]
if href.lower()[:8] == "/people/":
peopleList.append("http://events.cnbloggercon.org" + href + "profile/")
pageLink = []
for link in peopleList:
print link
ct = Page(str(link.encode("utf-8")).lower()).Content
pos = ct.find("个人网站")
if pos == -1:
continue
ct = ct[pos:]
so = BeautifulSoup(ct)
fLink = so("a")[0]["href"]
pageLink.append(fLink)
f = file("abcde.txt", "w")
for i in pageLink:
f.write(i)
f.write("\r\n")
示例2: get
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import find [as 别名]
def get(self, slug):
page = Page.find(slug=slug)[0]
page.content = "This is the content"
page.save()
return repr(page)
示例3: get_page
# 需要导入模块: from page import Page [as 别名]
# 或者: from page.Page import find [as 别名]
def get_page(year, month, day, slug):
def match(page):
date = page.date()
return date.year == year and date.month == month \
and date.day == day and page.slug() == slug
return Page.find(match)