s

Magic functions in Jupyter

By Angela C

April 11, 2021 in Jupyter notebook magic functions

Reading time: 1 minutes.

There are some magic functions in Jupyter that allow you to load functions, code from another notebook or script.

For example if you have a function in a Jupyter notebook, you can load the code into a cell of another Jupyter notebook.

  • The magic function %load will replace the contents of a cell with an external script, either from a local source or from a URL.

  • %%writefile can be used to save the contents of a cell in a notebook to an external file.

  • %pycat will show the contents of another Python file in a popup

  • %run can run the contents of another file.