在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:williamjameshandley/py2nb开源软件地址:https://github.com/williamjameshandley/py2nb开源编程语言:Python 74.9%开源软件介绍:py2nb: convert python scripts to jupyter notebooks
Description
Markdown cells are rendered from comments beginning with
InstallationUsers can install using pip: pip install py2nb from source: git clone https://github.com/williamjameshandley/py2nb
cd py2nb
python setup.py install or for those on Arch linux it is available on the AUR ExampleIf one has a script named #| # Testing ipython notebook
#| This is designed to demonstrate a simple script that converts a script into
#| a jupyter notebook with a simple additional markdown format.
#|
#| Code by default will be put into code cells
#|
#| * To make a markdown cell, prefix the comment line with with '#|' or '# |'
#| * To split a code cell, add a line beginning with '#-' or '# -'
import matplotlib.pyplot as plt
import numpy
%matplotlib inline
#| Here is a markdown cell.
#| Maths is also possible: $A=B$
#|
#| There are code cells below, split by `'#-'`:
# | Here is another markdown cell
x = numpy.random.rand(5)
#-------------------------------
y = numpy.random.rand(4)
z = numpy.random.rand(3)
#| Here are some plots
x = numpy.linspace(-2,2,1000)
y = x**3
fig, ax = plt.subplots()
ax.plot(x,y)
# -------------------------------
# | Here is another plot
x = np.linspace(-np.pi, np.pi, 201)
fig, ax = plt.subplots()
ax.plot(x,np.sin(x)) then running py2nb example.py produces the notebook example.ipynb To do
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论