# -*- coding:utf-8 -*-
from bs4 import BeautifulSoup
import urllib.request
import re
# 如果是网址,可以用这个办法来读取网页
# html_doc = "http://tieba.baidu.com/p/2460150866"
# req = urllib.request.Request(html_doc)
# webpage = urllib.request.urlopen(req)
# html = webpage.read()
html = """
<html><head><title>The Dormouse's story</title></head>
<body>
<p class="title" name="dromouse"><b>The Dormouse's story</b></p>
<p class="story">Once upon a time there were three little sisters; and their names were
<a href="http://example.com/elsie" rel="external nofollow" class="sister" id="xiaodeng"><!-- Elsie --></a>,
<a href="http://example.com/lacie" r
python 读取指定div的内容
最新推荐文章于 2023-06-10 17:52:50 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)