[Tutor] Text to HTML question.

SA phinsxiii@knology.net
Sun, 02 Jun 2002 12:10:13 -0500


Hi Everyone-

    I have a couple of questions for ya. Remember I'm new to Python and am
still learning:

1. I have a bunch of text files. I have a python script to generate html. I
would like to substitute the body of the text files in between <body></body>
of the html file. I think I can get this part. The trouble I'm having is
formatting the text body into html. For instance for every "\n" in the text
body I need to substitute <BR> before placing it into the html file body
section. And for every "\n\n" I wish to substitute <P>. I suppose I nead to
use regexp, but how do you call the re module and search/sub these patterns?

2. I'm sure this is probably a problem that has been solved before, so does
anyone know of a module to do this and how do I use it to accomplish the
goal?

Thanks in advance for your help. I'm just now starting to get the whole
class thing in Python.

SA