在本地编辑和运行代码
运行命令jupyter notebook
。如果浏览器未自动打开,请打开http://localhost:8888

你可以通过单击网页上显示的文件夹来访问notebook文件。它们通常有后缀".ipynb"。为了简洁起见,我们创建了一个临时的"test.ipynb"文件。单击后显示的内容如下图所示。此notebook包括一个标记单元格和一个代码单元格。标记单元格中的内容包括"This Is a Title"和"This is text."。代码单元包含两行Python代码。

双击标记单元格以进入编辑模式。在单元格末尾添加一个新的文本字符串"Hello world.",如下图所示。

运行后,markdown单元格如下图所示。

你还可以使用快捷键(默认情况下为Ctrl+Enter)运行单元格

当一个notebook包含更多单元格时,我们可以单击菜单栏中的"Kernel"\(\rightarrow\)"Restart & Run All"来运行整个notebook中的所有单元格。通过单击菜单栏中的"Help"\(\rightarrow\)"Edit Keyboard Shortcuts",可以根据你的首选项编辑快捷键。