text representation of HTML

Diez B. Roggisch deets at nospam.web.de
Wed Jul 19 06:20:04 EDT 2006


Ksenia Marasanova wrote:

> Hi,
> 
> I am looking for a library that will give me very simple text
> representation of HTML.
> For example
> <div><h1>Title</h1><p>This is a <br />test</p></div>
> 
> will be transformed to:
> 
> Title
> 
> This is a
> test
> 
> 
> i want to send plain text alternative of html email, and would prefer
> to do it automatically from HTML source.
> Any hints?

html2text is a commandline tool. You can invoke it from python using
subprocess.

Diez



More information about the Python-list mailing list