Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Scrape the text of all paragraph in python

# importing the HTMLSession class
from requests_html import HTMLSession
# create the object of the session
session = HTMLSession()
# url of the page
web_page = 'https://totalhealthmagazine.com/About-Us'
# making get request to the webpage
respone = session.get(web_page)
# getting the html of the page
page_html = respone.html
# finding all p tags
p_tags= page_html.find('p')
# extracting text from all h2 tags
for tag in p_tags:
    print(tag.text)Copy Code
Comment

PREVIOUS NEXT
Code Example
Python :: python for with iterator index 
Python :: Pandas groupby max multiple columns in pandas 
Python :: requests post with headers python 
Python :: append row to array python 
Python :: python -m pip install 
Python :: start new app in django 
Python :: argparse multiple arguments as list 
Python :: drop second column pandas 
Python :: how to print alternate numbers in python 
Python :: numpy multidimensional indexing 
Python :: NameError: name ‘pd’ is not defined 
Python :: apply strip() a column in pandas 
Python :: floyd triangle python 
Python :: tkinter hover button 
Python :: conda specify multiple channels 
Python :: pandas scatter plot with different colors 
Python :: django expressionwrapper example 
Python :: identify null values 
Python :: two input number sum in python 
Python :: python get filename without extension 
Python :: pandas replace nan 
Python :: how to make python speak 
Python :: download a file from kaggle notebook 
Python :: while loop countdown python 
Python :: godot string format 
Python :: how to add up everything in a list python 
Python :: web server python 
Python :: pyspark dataframe to single csv 
Python :: for loop with zip and enumerate 
Python :: convert excel to csv using python 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =