import requests
from bs4 import BeautifulSoup
import jieba
for i in range(2,10):
pages = i;
nexturl = 'http://www.shicimingju.com/chaxun/zuozhe/1_%s.html' % (pages)
reslist = requests.get(nexturl)
reslist.encoding = 'utf-8'
soup_list = BeautifulSoup(reslist.text, 'html.parser')
for news in soup_list.find_all('div',class_='summary'):
print(news.text)
f = open('123.txt', 'a', encoding='utf-8')
f.write(news.text)
f.close()
def changeTitleToDict():
f = open("123.txt", "r", encoding='utf-8')
str = f.read()
stringList = list(jieba.cut(str))
delWord = {"+", "/", "(", ")", "【", "】", " ", ";