【发布时间】:2013-10-17 14:09:46
【问题描述】:
我正在尝试了解 BeautifulSoup 的工作原理。请注意,我对 Python 很陌生,所以我可能遗漏了一些东西。
我打开一个 Python 终端并这样写:
from bs4 import BeautifulSoup
import re
ytchannel = '/home/XXX/Documents/test2'
soup = BeautifulSoup(ytchannel)
print(soup.prettify())
这是我得到的:
<html>
<body>
<p>
/home/XXX/Documents/test2
</p>
</body>
</html>
为什么?对我来说完全是无稽之谈。我只想要test2 的内容。
我写的正是 BeautifulSoup 网站上的内容。
【问题讨论】:
标签: python html beautifulsoup filepath