[Tutor] Extracting text from XML document

Kent Johnson kent37 at tds.net
Mon Jun 9 01:21:14 CEST 2008


On Sun, Jun 8, 2008 at 6:39 PM, Dinesh B Vadhia
<dineshbvadhia at hotmail.com> wrote:
> I want to extract text from XML (and SGML) documents.  I found one program
> by Paul Prescod
> (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65128) from 2001.
> Does anyone know of any programs that are more recent?

That recipe looks pretty good to me. If you need more control (e.g.
extracting text only from specific elements) look at ElementTree (now
in the standard lib).

Kent


More information about the Tutor mailing list