parsing in python

Peter Sprenger sprenger at moving-bytes.de
Wed Jun 9 09:39:01 CEST 2004


Hello,

I hope somebody can help me with my problem. I am writing Zope python 
scripts that will do parsing on text for dynamic webpages: I am getting 
a text from an oracle database that contains different tags that have to
be converted to a HTML expression. E.g. "<pic#>" ( # is an integer 
number) has to be converted to <img src="..."> where the image data 
comes also from a database table.
Since strings are immutable, is there an effective way to parse such 
texts in Python? In the process of finding and converting the embedded 
tags I also would like to make a word wrap on the generated HTML output 
to increase the readability of the generated HTML source.
Can I write an efficient parser in Python or should I extend Python with 
a C routine that will do this task in O(n)?

Regards

Peter Sprenger



More information about the Python-list mailing list