【发布时间】:2016-06-07 07:49:55
【问题描述】:
我需要将Tag 对象或“节点”转换为字符串。
这是我的代码:
import urllib
from bs4 import BeautifulSoup
class scraping:
site = urllib.urlopen("http://www.bbc.com/news/world-us-canada-36466228")
myfile = site.read()
soup = BeautifulSoup(myfile)
text = ""
for node in soup.findAll("p"):
print node
#None of two lines are working
#text.join(node)
#text += node
【问题讨论】:
标签: python beautifulsoup text-extraction