Answers for "read html beautifulsoup"

1

beautifulsoup open html file

#!/usr/bin/python

from bs4 import BeautifulSoup

with open('index.html', 'r') as f:

    contents = f.read()

    soup = BeautifulSoup(contents, 'lxml')

    print(soup.h2)
    print(soup.head)
    print(soup.li)
Posted by: Guest on May-15-2021

Code answers related to "read html beautifulsoup"

Python Answers by Framework

Browse Popular Code Answers by Language