ITNEPPer来てくれ質問がある #106

106以下、名無しにかわりましてVIPがお送りします:2018/12/19(水) 04:10:07.80 ID:v2r8hrMv

なるほどなるほど
参考になる
確かにこれ便利そうだ
利用したいけど、またわからんところがある
<strong style="color:#C84B00;font-size: 16px;">みたいなstrongタグにstyleタグ(?)がある場合うまく取得出来ない
>>105が貼ってくれたサイトの他にここも見た
http://python.zombie-hunting-club.com/entry/2017/11/08/192731
それに倣ってこう書いたんだが
print(soup.find_all('strong style="color:#C84B00;font-size: 16px;"').string)

Traceback (most recent call last):
File "/scraping.py", line 31, in <module>
print(soup.find_all('strong style="color:#C84B00;font-size: 16px;"').string)
File "/anaconda3/lib/python3.7/site-packages/bs4/element.py", line 1884, in __getattr__
"ResultSet object has no attribute '%s'. You're probably treating a list of items like a single item. Did you call find_all() when you meant to call find()?" % key
AttributeError: ResultSet object has no attribute 'string'. You're probably treating a list of items like a single item. Did you call find_all() when you meant to call find()?
Exited with status 1 after 15.916 seconds

ってエラーっすね。。。

このスレッドを全て表示


このスレッドは過去ログです。