Difference between ! and % in Jupyter Notebooks

前端 未结 1 925
故里飘歌
故里飘歌 2021-02-04 02:38

Both ! and % allow you to run shell commands from a Jupyter notebook.

% is provided by the IPython kernel and allows you to run \

1条回答
  •  感情败类
    2021-02-04 03:14

    ! calls out to a shell (in a new process), while % affects the process associated with the notebook (or the notebook itself; many % commands have no shell counterpart).
    !cd foo, by itself, has no lasting effect, since the process with the changed directory immediayely terminates. %cd foo changes the current directory of the notebook process, which is a lasting effect.

    0 讨论(0)
提交回复
热议问题