我尝试使用python3.6.1将RTF转换为XML/xhtml。在
Python代码:https://github.com/brendonh/pyth/blob/master/examples/reading/rtf15.py
import sys
import os.path
from pyth.plugins.rtf15.reader import Rtf15Reader
from pyth.plugins.xhtml.writer import XHTMLWriter
if len(sys.argv) > 1:
filename = sys.argv[1]
else:
filename = os.path.normpath(os.path.join(os.path.dirname(__file__),'../../tests/rtfs/sample.rtf'))
doc = Rtf15Reader.read(open(filename, "rb"))
print(XHTMLWriter.write(doc, pretty=True).read())
错误:
^{pr2}$我能知道怎么解决语法问题吗?在
谢谢。在
请检查链接:
https://pypi.python.org/pypi/pyth/0.6.0
pyth
包仅用于python2.x,而不适用于python3.x版本。在附言: 在您的示例代码中
是python2.x版本,而不是python3.x版本。请检查一下。在
相关问题 更多 >
编程相关推荐