使用Hydrogen,我如何保存他们的python脚本与输出包括像一个jupyter笔记本?

问题描述 投票:4回答:1

我是Atom和Jupyter的新手。我只安装了Hydrogen,我正在测试一个简单的脚本。我可以制作一些数据,shift + Enter显示内联的情节!我想保存文件w /我在Atom + Hydrogen GUI中看到的输出块。我见过这样的其他Jupyter笔记本。我可以这样做吗?

python python-2.7 atom-editor hydrogen
1个回答
0
投票

你可以使用Pandoctools。它可以将氢* .py / * .md文档导出为任何Pandoc输出格式或Jupyter笔记本。

例如,你可以create and register Jupyter内核。例如,可以命名为“nn”。这应该是您在Atom / Hydrogen中选择的内核。然后将帽子添加到Python文件中,将Hydrogen拆分为单元格,提供设置并设置Markdown单元格(注释的元数据行将导出到可以在nteract本机应用程序中打开的ipynb):

"""
---
kernels-map:
  py: nn
jupyter:
  kernelspec:
    display_name: nn
    language: python
    name: nn
pandoctools:
  out: "*.pdf"
  # out: "*.ipynb"
...

# Markdown section title 1

Some **static** Markdown text.
"""


# %% {echo=False}
import IPython.display as ds
import math
import sugartex as stex


# %% {markdown}
"""
# Markdown section title 2

The quick brown Fox jumps over the lazy dog.
"""


# %%
ds.Markdown(stex.pre(f'''

Some **dynamic** Markdown text with SugarTeX formula: ˎα^˱{math.pi:1.3f}˲ˎ.
It works because of the `Markdown` display option and `sugartex` Pandoc filter.
Acually `stex.pre` is redundant here but it is needed when the text is imported
or read from somewhere instead of being written in the same document.

'''))

然后通过pandoctools转换文件:将文件拖放到pandoctools快捷方式/可执行文件或“打开方式”pandoctools可执行文件。

另见:

© www.soinside.com 2019 - 2024. All rights reserved.