【发布时间】:2013-03-11 09:15:12
【问题描述】:
我正在尝试编写一个脚本,可以将 \\[ 或 \\] 之类的内容转换为 $$,以便将 MultiMarkdown 文档转换为可以在 HTML 中显示方程式的 Pandoc markdown 文档。我正在使用 Python 使用
matchstring=r'\\['
re.sub(matchstring,'$$',content)
但是我遇到了以下错误:
unexpected end of regular expression:line 15:matchstring=re.compile(r'\\[')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 190:
return _compile(pattern, flags)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 245:
raise error, v # invalid expression
很可能是因为我在其中的最后一个[。有谁知道解决这个问题的方法吗?
【问题讨论】:
标签: python pandoc multimarkdown