小编J.E*_*Ewa的帖子

美丽的汤附加

我不明白为什么这不起作用。

soup_main = BeautifulSoup('<html><head></head><body><a>FooBar</a></body></html>')
soup_append = BeautifulSoup('<html><head></head><body><a>Meh</a></body></html>')
soup_main.body.append(soup_append.a)
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Traceback (most recent call last):File "<stdin>", line 1, in <module>
File "C:\Python34\lib\site-packages\bs4\element.py", line 378, in append
self.insert(len(self.contents), tag)
File "C:\Python34\lib\site-packages\bs4\element.py", line 312, in insert
raise ValueError("Cannot insert None into a tag.")
ValueError: Cannot insert None into a tag.
Run Code Online (Sandbox Code Playgroud)

如果我能理解正在发生的事情,我会很高兴。

python beautifulsoup

2
推荐指数
1
解决办法
1360
查看次数

标签 统计

beautifulsoup ×1

python ×1