File: rtf15.py

package info (click to toggle)
pyth 0.5.6-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 312 kB
  • sloc: python: 1,609; makefile: 7
file content (13 lines) | stat: -rw-r--r-- 292 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
from pyth.plugins.rtf15.reader import Rtf15Reader
from pyth.plugins.xhtml.writer import XHTMLWriter

import sys

if len(sys.argv) > 1:
    filename = sys.argv[1]
else:
    filename = "sample.rtf"

doc = Rtf15Reader.read(open(filename, "rb"))

print XHTMLWriter.write(doc, pretty=True).read()