Dec-21-2017, 08:30 AM
(This post was last modified: Dec-21-2017, 08:30 AM by sumandas89.)
I used this code to pick up the data as you suggested -
but I am getting the following error though there are several classes where text is present -
url_get = requests.get(url) soup = BeautifulSoup(url_get.content,'lxml') print(soup.find(class_="_c24 _50f4").text)In the 'url' variable I am taking the URL of my practice website, and then getting the code of the website in soup variable.
but I am getting the following error though there are several classes where text is present -
Error:[b]Traceback (most recent call last):
File "/home/csurv_4/PycharmProjects/web_parsing/data_fetching.py", line 18, in <module>
print(soup.find(class_= "_c24 _50f4").text)
AttributeError: 'NoneType' object has no attribute 'text'[/b]
I want to know the mistake I am doing, and what to do if there are multiple classes with the same name. How I can retrieve the all the data with that class name?