jupyterlab运行同一notebook时,由于之前的变量还在 IPython 的内存中,所以会出现异常情况。我们将讨论如何清除notebook中的变量,以避免遇到这种情况。
清除所有变量-需要用户同意
%reset清除所有变量-不需要用户同意
%reset -f
代码清除所有变量
from IPython import get_ipython
get_ipython().magic("reset -sf")
# Your code 日常学习、工作的点滴记录
jupyterlab运行同一notebook时,由于之前的变量还在 IPython 的内存中,所以会出现异常情况。我们将讨论如何清除notebook中的变量,以避免遇到这种情况。
%reset%reset -f
from IPython import get_ipython
get_ipython().magic("reset -sf")
# Your code