[Tutor] parse text for paragraghs/sections

Dinesh B Vadhia dineshbvadhia at hotmail.com
Mon Apr 20 18:07:01 CEST 2009


Hi!  I want to parse text and pickup sections.  For example, from the text:

t = """abc <pre> DEF ghi jkl </pre> MNO pqr"""

... pickup all text between the tags <pre> and </pre> and replace with another piece of text.

I tried 

t = re.sub(r"\<pre>[A-Za-z0-9]\</pre>", "DBV", t)

... but it doesn't work.

How do you do this with re?  

Thanks

Dinesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090420/1009678b/attachment.htm>


More information about the Tutor mailing list