webスクレイピングをサイトを見て勉強しようとしていたところ、エラーが出ました。
Noneに対して実行をかけているなかなと思うのですがタイトルを引っ張ってくるためにはどのようにすればよいでしょうか?コードとエラー文、参考にしたwebサイトのURLを貼っておきます。わかる方お願いします。
python
1import requests 2response=requests.get('http://test.neet-ai.com') 3print(response.text) 4soup=BeautifulSoup(response.text,"lxml") 5title=soup.title.string
error文
1--------------------------------------------------------------------------- 2AttributeError Traceback (most recent call last) 3<ipython-input-11-a9e7b6c467ec> in <module> 4----> 1 title=soup.title.string 5 6AttributeError: 'NoneType' object has no attribute 'string'
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。