>>> from xml.sax.saxutils import escape >>> escape('''<html>& " '</html>''') '<html>& " \'</html>' Beautiful Soup: We called him Tortoise because he taught us. インストール Index of /software/BeautifulSoup/download $ wget http://www.crummy.com/software/BeautifulSoup/download/BeautifulSoup.tar.gz $ tar xvzf BeautifulSoup.tar.gz $ cd BeautifulSoup-3.0.3 $ sudo python setup.py install サンプル