2
私はこのサイトを掻き集め、2つの別々のタグを取得しようとしています。これはhtmlのように見えます。Python 3美しいスープ結腸のタグを見つける
<url>
<loc>
http://link.com
</loc>
<lastmod>date</lastmode>
<changefreq>daily</changefreq>
<image:image>
<image:loc>
https://imagelink.com
<image:loc>
<image:title>Item title</image:title>
<image:image>
</url>
私が得ようとしているタグは、locとimage:titleです。私が抱えている問題は、タイトルタグのコロンです。 (私はこれまでのところ、私もちょうど
print(item.title)
を行うことを試みている
r = requests.get(url)
soup = BeautifulSoup(r.content, 'html.parser')
for item in soup.find_all('url'):
print(item.loc)
#print image title
ありましたが、それは
これはxmlがhtmlではなく、名前空間が2つではない1つのノードです。あなたはどこから手に入れていますか? –