Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how list ul li with python scraping

# importing the modules
import requests
from bs4 import BeautifulSoup
  
# providing url
url = "https://auth.geeksforgeeks.org/user/adityaprasad1308/articles"
  
# creating requests object
html = requests.get(url).content
  
# creating soup object
data = BeautifulSoup(html, 'html.parser')
  
# finding parent <ul> tag
parent = data.find("body").find("ul")
  
# finding all <li> tags
text = list(parent.descendants)
  
# printing the content in <li> tag
print(text)
for i in range(2, len(text), 2):
    print(text[i], end=" ")
Comment

PREVIOUS NEXT
Code Example
Python :: python datetime with day date suffix format 
Python :: sns boxplot ylabelsize 
Python :: matplotlib pie edge width 
Python :: create frequency tables in pandas 
Python :: complete dates pandas 
Python :: saving model 
Python :: pandas excelfile 
Python :: how to open a file in python 
Python :: fetch json array from mysql django 
Python :: k fold CV with xgboost 
Python :: how to create one list from 2d list python 
Python :: sklearn grid search cv show progress 
Python :: python var power of 2 
Python :: Python Pandas export Dataframe to csv File 
Python :: pytesseract restrict char 
Python :: conditional relationship sqlalchemy 
Python :: add colorbar without changing subplot size 
Python :: python string lowercase 
Python :: df dtype 
Python :: Python NumPy squeeze function Example 
Python :: pydub create empty track 
Python :: how to make a window with tkinter 
Python :: pandas sequential numbering within group 
Python :: Python __floordiv__ magic method 
Python :: difference between == and is 
Python :: get value of property of object with name python 
Python :: how to redirect where requests library downloads file python 
Python :: The function to be built, amino_acids, must return a list of a tuple and an integer when given a string of mRNA code. 
Python :: python typewriter effect 
Python :: python read file between two strings 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =