Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python get news headlines

import requests
from bs4 import BeautifulSoup

url='https://www.bbc.com/news'
response = requests.get(url)

soup = BeautifulSoup(response.text, 'html.parser')
headlines = soup.find('body').find_all('h3')
for x in headlines:
    print(x.text.strip())
Comment

PREVIOUS NEXT
Code Example
Python :: create django user command line 
Python :: hello world flask python 
Python :: fill a list with random numbers 
Python :: python delete the last line of console 
Python :: dataframe from arrays python 
Python :: torch save 
Python :: union df pandas 
Python :: rename files in a folder python 
Python :: save strings with numpy savetext 
Python :: climate change 
Python :: how to change the datatype of a row in pandas 
Python :: python time function duration and memory usage 
Python :: python how to copy a 2d array leaving out last column 
Python :: window in python 
Python :: remove turtle 
Python :: python exceute 60 records per minute counter 
Python :: comparing file content in python 
Python :: A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable. 
Python :: log base in python 
Python :: flask console log 
Python :: debugar python 
Python :: python current utc offset 
Python :: how to iterate through a text file in python 
Python :: creating folder in s3 bucket python 
Python :: run file as administrator python 
Python :: panda check a cell value is not a number 
Python :: powershell get list of groups and members 
Python :: python emoji 
Python :: scrapy user agent 
Python :: Violin Plots in Seaborn 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =