Jupyter中感叹号和百分号的区别

发布时间 2023-08-07 11:40:52作者: tangjicheng

! 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 immediately terminates.

%cd foo changes the current directory of the notebook process, which is a lasting effect.

!调用 shell(在新进程中),而 % 影响与笔记本(或笔记本本身;许多 % 命令没有 shell 对应项)关联的进程。

!cd foo 本身没有持久的影响,因为更改目录的进程会立即终止。

%cd foo 更改笔记本进程的当前目录,这是一个持久的效果。