Python网络爬虫实战 课时 5 用BeautifulSoup 剖析网页元素 源码

# -*- coding: UTF-8 -*-

from bs4 import BeautifulSoup

html_sample = ‘ \

<html> \

<body> \

<h1 id = “title”>Hello World</h1> \

<a href =”#” class=”link”>this is link1</a> \

<a href = “# link2” Class = “link”>This is link2</a> \

</body> \

</html>’

soup = BeautifulSoup(html_sample,’html.parser’)

print(soup.text)

课时
5
用BeautifulSoup 剖析网页元素

    原文作者:pySVN8A
    原文地址: https://blog.csdn.net/pySVN8A/article/details/80030140
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞