-2
我想了解BeautifulSoup的工作原理。請注意,我對Python非常陌生,所以我可能錯過了一些東西。BeautifulSoup - 爲什麼打印文件路徑而不是內容
我打開一個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網站上寫的內容。
謝謝你的幫助! – user1983400