[Chennaipy] Chennaipy - Monday Module - 10 Oct 2022

selvi dct selvi.dct at gmail.com
Mon Oct 10 14:01:16 EDT 2022


Date: 10 Oct 2022


Module : BeautifulSoup


Installation : pip install BeautifulSoup


About:

Beautiful Soup is a library that makes it easy to scrape information from
web pages. It sits atop an HTML or XML parser, providing Pythonic idioms
for iterating, searching, and modifying the parse tree.


Source:

import requests

from bs4 import BeautifulSoup



URL = "http://www.values.com/inspirational-quotes"

r = requests.get(URL)



soup = BeautifulSoup(r.content, 'html5lib') # If this line causes an error,
run 'pip install html5lib' or install html5lib

print(soup.prettify())


Reference:

https://pypi.org/project/BeautifulSoup/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/chennaipy/attachments/20221010/f8947c1d/attachment.html>


More information about the Chennaipy mailing list