import nbformat nb = nbformat.v4.new_notebook() title = "# タイトル" code = """ %matplotlib inline from sympy import * # to print with mathjax on jupyter notebook init_printing() """ nb["cells"] = [ nbformat.v4.new_markdown_cell(title), nbformat.v4.new_code_cell(code) ] with open("output.ipynb", "w") as f: nbformat.write(nb, f) これで、色々便利なことができそうですね。 PyCharmでカスタムした.ipynbを生成する PyCharmはPythonの統合開発環境(IDE)で
