plain text parsing to html (newbie problem)

Terry Reedy tjreedy at udel.edu
Wed Dec 9 12:04:21 EST 2009


João wrote:
> I apologize for my newbiness but I'm banging my head making this work :
> (
> What change must I made for the tag enforcement being reflected to the
> 'mail' file? Am I using the WritableObject class correctly?
> (I'm getting a blank 'mail' file after running the .py script)
> How can I see the output run in debug mode like in perl?
> 
> #!/usr/bin/env python
> 
> import sys, os
> import subprocess
> import re
> import datetime
> 
> # simple class with write method to redirect print output to a file
> class WritableObject:
>     def __init__(self):
>         self.content = []
>     def write(self, string):
>         self.content.append(string)

Python comes with a stringio class that does this *AND* has a method to 
retrieve the result. StringIO in 2.x, io module in 3.x




More information about the Python-list mailing list