python爬虫:BF4安装与使用

2020-12-13 05:02

阅读:367

YPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">

标签:title   html   解析   head   美化   import   pip3   from   python爬虫   

‘‘‘
安装解析器:
pip3 install lxml
安装解析库:
pip3 install bs4
‘‘‘

html_doc = ‘‘‘The Dormouse‘s story

$37

Once upon a time there were three little sisters; and their names were Elsie, Lacie and Tillie; and they lived at the bottom of a well.

...

‘‘‘ from bs4 import BeautifulSoup # python自带解析库 # soup = BeautifulSoup(html_doc,‘html.parser‘) # 调用bs4得到 一个soup对象 soup = BeautifulSoup(html_doc,‘lxml‘) # bs4对象 print(soup) # bs4类型 print(type(soup)) # 美化功能 html = soup.prettify() print(html)

  

python爬虫:BF4安装与使用

标签:title   html   解析   head   美化   import   pip3   from   python爬虫   

原文地址:https://www.cnblogs.com/Auraro997/p/11128167.html


评论


亲,登录后才可以留言!