pypandoc ( Pandocの python ラッパー)を使用して HTML 文字列を LaTex に変換しようとしています。
pypandoc を使用したファイルのカバーは問題なく機能します。
import pypandoc
input = 'SomeFile.html'
output = pypandoc.convert(input, 'tex')
しかし、文字列を渡そうとすると (文字列形式を定義すれば、pypandoc パッケージのインデックスに従って可能になるはずです)、次のようになりますIOError: [Errno 63] File name too long:
:
input = '''HTML-string'''
output = pypandoc.convert(input, 'tex', format='html')
を指定してもなぜかファイルが期待されますformat='html'
。
また、StringIO モジュールを使用してこの問題を回避しようとしましたが、成功しませんでした。
import pypandoc
import StringIO
output = StringIO.StringIO()
output.write('''HTML-string''')
contents = output.getvalue()
output.close()
convertedOutput = pypandoc.convert(contents, 'tex', format='html')
私はPythonが初めてで、助けやヒントをいただければ幸いです。前もって感謝します!