【发布时间】:2019-05-08 12:16:38
【问题描述】:
我有这个 xml:
<dc:type>image fixe</dc:type>
<dc:type>image</dc:type>
<dc:type>still image</dc:type>
<dc:type>dessin</dc:type>
<dc:type>drawing</dc:type>
我想要所有“dc:type”标签的所有文本。我可以使用soup.find("dc:type").get_text() 获得第一个,但是当我尝试时,例如:
for i in soup.find_all("dc:type"):
type = "|".join(i.get_text())
它什么也得不到。仅打印soup.find_all("dc:type") 也一无所获,而仅使用 find 打印似乎还可以。
我做错了什么?
【问题讨论】:
标签: xml beautifulsoup tags