I am using python to convert a rtf file to plain text. I am using pyth to convert it, but it ends up in a format that I don't recognize.
Here is my input python script:
from pyth.plugins.rtf15.reader import Rtf15Reader
from pyth.plugins.plaintext.writer import PlaintextWriter
import sys
if len(sys.argv) > 1:
filename = sys.argv[1]
else:
filename = "C:\localdata\logbook.rtf"
doc = Rtf15Reader.read(open(filename, "rb"))
y = [x.content for x in doc.content]
for j in y:
print j
Here is what the ouput looks like:
[Text('[AJAJ]' {})]
[Text('[07:30 - Setup IP address]' {})]
[Text('[copied DM Queue and recipies from AYT404]' {})]
[Text('[07:50 - Backed up system pre SP7]' {})]
[Text('[08:00 - Installing SP7]' {})]
[Text('[08:15 - Startup Drivers -> OK]' {})]
Does anyone know what format this is and how can I convert this to something more readable?
print PlaintextWriter.write(doc).getvalue()print jyou'd haveprint j[8:-7]