respone = requests.get('https://www.meiwen.com.cn/article/58030.html')
#解析获取到的网页信息
result_list = BeautifulSoup(respone.text,'lxml')
#在解析的信息中查找p标签,
soup = result_list.select('p')
#将soup列表转换为文本格式,并且保存到txt文件中
for result in soup:
res = result.text
# print(res)
with open('D:\download\meiwen.txt', 'a',encoding='utf-8') as file:
file.write(res)
print('success')
相关文章
- 01-07Python爬取某财经网头条信息一段小程序
- 01-07用python 爬取网页图片
- 01-07python3爬取网页
- 01-07Python爬虫开源项目代码,爬取微信、淘宝、豆瓣、知乎、新浪微博、QQ、去哪网等 代码整理
- 01-07python爬取网页信息时出现UnicodeEncodeError
- 01-07python requests库网页爬取小实例:百度/360搜索关键词提交
- 01-07python requests库爬取网页小实例:爬取网页图片
- 01-07python requests库网页爬取小实例:亚马逊商品页面的爬取
- 01-07Python爬虫入门教程 3-100 美空网数据爬取
- 01-07Python爬虫入门教程 10-100 图虫网多线程爬取