#读取每一条信息
def get_txt(haha):
soup = BeautifulSoup(haha)
all_txt = soup.find_all('div', class_="content")
i = 1
for txt in all_txt:
cont = str(txt)
head = cont.find(r'class="content"')
end = cont.find(r'</div', head)
con = cont[head + 16:end]
print str(i), con
i = i + 1
time.sleep(3)
#根据输入的数字,确定打印起始页
page = raw_input("Please input a number:")
p = int(page)
#使用while循环打印出所有信息
while p < 36:
haha = get_con(url + str(p) + '?s=4796159', my_headers)
print get_txt(haha)
print "这是第" + str(p) + "页"
p = p + 1