Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

change tag name using beautifulsoup python

import BeautifulSoup

if __name__ == "__main__":
    data = """
<html>
<h2 class='someclass'>some title</h2>
<ul>
   <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
   <li>Aliquam tincidunt mauris eu risus.</li>
   <li>Vestibulum auctor dapibus neque.</li>
</ul>
</html>

    """
    soup = BeautifulSoup.BeautifulSoup(data)
    h2 = soup.find('h2')
    h2.name = 'h1'
    print soup
Comment

PREVIOUS NEXT
Code Example
Python :: how to set notepad ++ for run python 
Python :: Determining Web Address In Django 
Python :: sklearn list parameters 
Python :: install robobrowser python 3 
Python :: property values 
Python :: enter three numbers and find smallest number in python 
Python :: jntuk r20 1-2 python lab manual 
Python :: 0 in python 
Python :: find element by partial link text selenium python 
Python :: how to classify numbers in python 
Python :: python recognize lower and upper case user input 
Python :: python count down advanced 
Python :: python Access both key and value using items() 
Python :: quicksort python3 
Python :: check if variable is iterable python 
Python :: preventing players from changing existing entries in tic tac toe game 
Python :: dalsports 
Python :: how to install pandas in python by git 
Python :: The module in NAME could not be imported: django.contrib.user_auth.password_validation.UserAttributeSimilarityValidator. Check your AUTH_PASSWORD_VALI 
Python :: how to do welcome in bubble letters in python 
Python :: How to send data to scrapy pipeline to mongodb 
Python :: can data scientists become software developer 
Python :: find that are not images in the entire images folder. 
Python :: dont print pip jupyter 
Python :: flask logging miguel grinberg 
Python :: python read and write lines in file 
Python :: pyspark percentage missing values 
Python :: put legend in subplot 
Python :: genrate requirments.txt pytohn 
Python :: pandas to_csv adds unnamed column 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =