私は BeautifulSoup を使用しようとしているので、HTML<div>
タグのリストを取得し、name 属性があるかどうかを確認してから、その属性値を返します。私のコードを見てください:
soup = BeautifulSoup(html) #assume html contains <div> tags with a name attribute
nameTags = soup.findAll('name')
for n in nameTags:
if n.has_key('name'):
#get the value of the name attribute
私の質問は、name 属性の値を取得するにはどうすればよいですか?