%%writefile myfile.py
-a
to append). Another alias: %%file myfile.py
%run myfile.py
%load myfile.py
%lsmagic
%COMMAND-NAME?
%run?
Beside the cell magic commands, IPython notebook (now Jupyter notebook) is so cool that it allows you to use any unix command right from the cell (this is also equivalent to using the %%bash
cell magic command).
To run a unix command from the cell, just precede your command with !
mark. for example:
!python --version
see your python version!python myfile.py
run myfile.py and output results in the current cell, just like %run
(see the difference between !python
and %run
in the comments below).Also, see this nbviewer for further explanation with examples. Hope this helps.