0

I want to print a text from div that has this class="enrte_text_itempo" Can i print it just by typing this or someithng like this?

for div in soup.find_all("div", { class = "enrte_text_itempo"}):
    print(div.get_text())

because i get an error that says invalid syntax and points my word:class

DirtyBit
  • 15,671
  • 4
  • 26
  • 53

1 Answers1

1

Using the correct syntax:

desired_divs = soup.find_all("div", {"class" : "enrte_text_itempo"})

OR

You could search by the class_ keyword:

desired_divs = soup.find_all("div", class_="enrte_text_itempo")
for div in desried_divs:
    print(div)
DirtyBit
  • 15,671
  • 4
  • 26
  • 53