【发布时间】:2021-08-20 01:38:03
【问题描述】:
如何将您在网页上看到的内容/内容提取为字符串 例如转这个:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>myWebpage</title>
</head>
<body>
<p>this</p>
<p>is</p>
<p>an</p>
<p>example</p>
</body>
</html>
变成这样的字符串:
this is an example
【问题讨论】:
-
到目前为止你有什么尝试?
-
使用
BeautifulSoup包。
标签: python html python-3.x type-conversion