BeautifulSoupにおいて、階層構造にある、aタグのhref属性を取得したいのですが、現在手詰まりといった状況でして...
具体的なコードは以下となります。
soup = BeautifulSoup(get_response(elem).text,'lxml') tokyo_detail_page = soup.select('article .listR .floatR a')
こちらの、aタグのhrefを取得したいのですがhref = detail_page.get('href')
このようにすると以下のようなエラーが出てしまい、取得することができません。
"ResultSet object has no attribute '%s'. You're probably treating a list of elements like a single element. Did you call find_all() when you meant to call find()?" % key
AttributeError: ResultSet object has no attribute 'get'. You're probably treating a list of elements like a single element. Did you call find_all() when you meant to call find()?
どなたかご助言頂けましたら幸いです。
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/01/27 09:01