要从GitHub(或互联网上的任何其他地方)导入Jupyter notebook,您需要:
- Download the file.
- Run it in Jupyter.
例如有一个Jupyter notebook的Python示例,git存储库:https://raw.githubusercontent.com/aaaaa/to_be_imported/master/to_be_import.ipynb
在另一个文件中,我写了以下Python代码:
!curl -O https://raw.githubusercontent.com/mikulskibartosz/to_be_imported/master/to_be_imported.ipynb
%run to_be_imported.ipynb
第一行下载文件并将其存储。第二行将文件导入Jupyter笔记本。
备注:
如果您在机器上运行Jupyter notebook时导入了一个文件,那么导入的Python代码将在您的机器上执行!
导入的notebook可以访问你的文件(可以删除、修改或上传)。它还可能包含下载可执行文件并在计算机上运行的代码。
閱讀更多 不靠譜的貓 的文章