= Introduction =
>>> from bs4 import BeautifulSoup
>>> soup = BeautifulSoup("
SomebadHTML")
>>> print soup.prettify()
Some
bad
HTML
>>> soup.find(text="bad")
u'bad'
>>> soup.i
HTML
>>> soup = BeautifulSoup("SomebadXML", "xml")
>>> print soup.prettify()
Some
bad
XML
The bs4/doc directory contains full documentation in Sphinx
format. Run "make html" to create HTML documentation.
= Running the unit tests =
Here's how to run the tests on Python 2.7:
$ cd bs4
$ python2.7 -m unittest discover -s bs4
Here's how to do it with Python 3.2:
$ ./convert-py3k
$ cd py3k/bs4
$ python3 -m unittest discover -s bs4
The script test-all-versions will run the tests twice, once on Python
2.7 and once on Python 3.