Answers for "scrape all text from p tags on a website beautifulsoup"

1

beautifulsoup get text

# Find all of the text between paragraph tags and strip out the html
page = soup.find('p').getText()
Posted by: Guest on September-17-2020
0

scrape text from specific p tag

from bs4 import BeautifulSoup
import urllib

url = urllib.urlopen('http://meinparlament.diepresse.com/')
content = url.read()
soup = BeautifulSoup(content, 'lxml')

table = soup.findAll('div',attrs={"class":"content-question"})
for x in table:
    print x.find('p').text

# Another way to retrieve tables:
# table = soup.select('div[class="content-question"]')
Posted by: Guest on June-25-2020

Code answers related to "scrape all text from p tags on a website beautifulsoup"

Browse Popular Code Answers by Language