简单的页面

rom bs4 import BeautifulSoup
r = '''
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)  40号的作业</title>
</head>
<body>
 
<h1>我的第一个标题</h1>
<p id="first">我的第一个段落。</p >
 
</body>
    <table border="1">
        <tr>
            <td>row 1, cell 1</td>
            <td>row 1, cell 2</td>
        </tr>
    </table>
</html>
'''
demo = BeautifulSoup(r,"html.parser")
 
print(demo.title)
print(demo.body)
print(demo.p)
print(demo.string)

 

posted @ 2020-12-14 17:40  小C+  阅读(97)  评论(0)    收藏  举报